Example #1
0
    void Update()
    {
        if (transform.position.y < -200)
        {
            respawn.Respawn();
        }

        if (enemyFound == false)
        {
            enemyInRange = false;
        }
        aiVision();

        /*
         * need hovermode somewhere here
         */

        //searches for a nearby weapon
        if (!enemyFound && !hasWeapon)
        {
            findWeapon();
        }

        //chases an enemy that is in range so that the  AI can use the weapon
        if (enemyFound && !enemyInRange && hasWeapon)
        {
            chase();
        }

        //uses weapon on target
        if (enemyFound && enemyInRange && hasWeapon)
        {
            //useWeapon();
        }

        if (!enemyFound && hasWeapon)
        {
            findEnemy();
            if (Vector3.Distance(currNode.transform.position, transform.position) < nodeArr.Length)
            {
                nodeNum++;
                if (nodeNum > nodeArr.Length - 1)
                {
                    nodeNum = 0;
                }
                currNode = nodeArr[nodeNum];
                atNode   = nodeNum;
            }
        }
    }
Example #2
0
    void Update()
    {
        if (transform.position.y < -200)
        {
            kartStatus.Respawn();
        }

        if (Input.GetButtonDown(buttonFire))
        {
            ItemsController.UseItem();
        }

        if (kartStatus.GetKartMode() == KartMode.Kart)
        {
            GeomController.SpinWheels(Colliders.FR.rpm / 60 * 360 * Time.deltaTime);
            GeomController.TurnFrontWheels(Colliders.FL.steerAngle, Colliders.FR.steerAngle);
        }

        if (rigidbody.velocity == Vector3.zero)
        {
            rigidbody.angularVelocity = Vector3.zero;
        }
    }