Пример #1
0
    private void Awake()
    {
        gravityPoints = FindObjectOfType <GravityPoints>();
        body          = GetComponent <Rigidbody2D>();

        body.AddForce(initialImpulse, ForceMode2D.Impulse);
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        player              = GameObject.FindWithTag("Player");
        playerEventManager  = player.GetComponent <EventManager>();
        playerGravity       = player.GetComponent <Gravity>();
        playerGravityPoints = player.GetComponent <GravityPoints>();

        eventManager = GetComponent <EventManager>();
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        eventManager  = GetComponent <EventManager>();
        gravity       = GetComponent <Gravity>();
        gravityPoints = GetComponent <GravityPoints>();
        entityMover   = GetComponent <EntityMover>();
        entityRotator = GetComponent <EntityRotator>();

        // This grabs the gameobject within the player called playerRange,
        //  takes the script of that object in order to check whether an enemy is close or not.
        encounter = GameObject.Find("playerRange").GetComponent <EntityEncounter>();//~

        // Current input affecting movement
        // May differ fron actual movement in case of obstacles, being in the air, etc
        movement = Movement.Stopped;

        // Current input affecting direction
        // Likely matches actual direction, since turning around is not hindered by obstacles
        direction = Direction.Right;
    }