protected override void Initialize()
        {
            myRigidbody.freezeRotation = true;

            _input = GetComponent <CharacterInput>();
            if (!_input)
            {
                _input = gameObject.AddComponent <CharacterInput>();
            }
        }
Example #2
0
 private void Start()
 {
     _master = GetComponent <CharacterMaster>();
     _input  = GetComponent <CharacterInput>();
     _sounds = GetComponent <CharacterSoundManager>();
     _keys   = new Dictionary <Direction, Key>
     {
         [Direction.Up]    = new Key(_input.upKey, Direction.Up, Vector3.left, Vector3.forward, () => left.transform.position),
         [Direction.Left]  = new Key(_input.leftKey, Direction.Left, Vector3.back, Vector3.left, () => down.transform.position),
         [Direction.Down]  = new Key(_input.downKey, Direction.Down, Vector3.right, Vector3.back, () => right.transform.position),
         [Direction.Right] = new Key(_input.rightKey, Direction.Right, Vector3.forward, Vector3.right, () => up.transform.position),
     };
     _currentTile            = getTile();
     _currentTile.isOccupied = true;
 }