animal move brokey

This commit is contained in:
dhain 2022-06-10 09:45:18 +02:00
parent 0ff64fd318
commit f15a762a04
4 changed files with 37 additions and 12 deletions

View file

@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 2510115116361252819}
- component: {fileID: 2510115116361252816}
- component: {fileID: 123187747779251107}
- component: {fileID: 2510115116361252818}
- component: {fileID: 4094795090309576525}
m_Layer: 0
@ -86,6 +87,27 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!50 &123187747779251107
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2510115116361252817}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!60 &2510115116361252818
PolygonCollider2D:
m_ObjectHideFlags: 0

View file

@ -1,16 +1,25 @@
using System;
using DefaultNamespace;
using UnityEngine;
using Random = UnityEngine.Random;
public class Animal : MonoBehaviour {
protected Sprite animalSprite;
private Item producedItem;
private Item _producedItem;
private Rigidbody2D _rigidbody;
public Item ProducedItem => _producedItem;
protected Animal(Item producedItem) {
this.producedItem = producedItem;
private void Start() {
_rigidbody = gameObject.GetComponent<Rigidbody2D>();
_rigidbody.velocity = new Vector2(Random.Range(1, 10),
Random.Range(1, 10));
}
// TODO: Movement
private void Update() {
_rigidbody.velocity = new Vector2(_rigidbody.velocity.x * Random.Range(0, 10),
_rigidbody.velocity.y * Random.Range(0, 10));// TODO: wer?
}
// TODO: Animations
private void OnMouseDown() {

View file

@ -1,3 +0,0 @@
public interface IPurchasable {
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: b4a4f63f7f474fa18f9b72f6ac175e7f
timeCreated: 1654844062