Example #1
0
    // Update is called once per frame
    // LateUpdate is the same, but its called after the normal Update()-s, which means it will be after the EnemyScripts's Update, and that all the variables will be up-to-date
    void LateUpdate()
    {
        //get the vector data from the enemy handler
        dirToTarget = myHandler.GetDirToPlayer();

        //myHandler.GetTargetVectorData(ref dirToTarget, ref distToTarget);

        RotateIn2D(dirToTarget);
    }
Example #2
0
    // Update is called once per frame
    // LateUpdate is the same, but its called after the normal Update()-s, which means it will be after the EnemyScripts's Update, and that all the variables will be up-to-date
    void LateUpdate()
    {
        //get the vector data from the enemy handler
        dirToTarget  = myHandler.GetDirToPlayer();
        distToTarget = myHandler.GetDistToTarget();

        //myHandler.GetTargetVectorData(ref dirToTarget, ref distToTarget);

        //if (distToTarget > distToStop && distToStart > distToTarget)
        {
            MoveInDir(dirToTarget);
        }
    }
Example #3
0
    // Update is called once per frame
    // LateUpdate is the same, but its called after the normal Update()-s, which means it will be after the EnemyScripts's Update, and that all the variables will be up-to-date
    void LateUpdate()
    {
        //get the vector data from the enemy handler
        dirToTarget  = myHandler.GetDirToPlayer();
        distToTarget = myHandler.GetDistToTarget();

        //myHandler.GetTargetVectorData(ref dirToTarget, ref distToTarget);

        //if (distToTarget > distToStop && distToStart > distToTarget)
        {
            Vector3 oppositeDir = new Vector3(-1 * dirToTarget.x, -1 * dirToTarget.y, 0);
            MoveInDir(oppositeDir);
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        //get the vector data from the enemy handler
        dirToTarget  = myHandler.GetDirToPlayer();
        distToTarget = myHandler.GetDistToTarget();

        //myHandler.GetTargetVectorData(ref dirToTarget, ref distToTarget);

        if (curCooldown > 0)
        {
            curCooldown -= Time.deltaTime;
        }
        else// if (distToTarget < distToAttack)
        {
            Attack();
            curCooldown = cooldown;
        }
    }