コード例 #1
0
    void AIControl()
    {
        if (AITarget == null)
        {
            return;
        }

        agent.SetDestination(AITarget.position);
        transform.LookAt(AITarget);
        transform.Rotate(0, 180, 0);

        if (robotTarget == null)
        {
            return;
        }

        if (robotTarget.robotLaborerControl.isFighter)
        {
            //if distance is shorter then ram is distance - ram
            if (TargetDistance() < AIData.GetRamDistance())
            {
                robotManager.robotAttack.InitiateRam();
            }
        }
    }
コード例 #2
0
ファイル: RSMovement.cs プロジェクト: HappySaila/RIR
    void AIControl()
    {
        if (canMove)
        {
            if (AITarget == null)
            {
                //Debug.Log("null");
                return;
            }


            if (!robotTarget.robotMovement.inBase)
            {
                agent.SetDestination(AITarget.position);
            }



            Transform currentForward = transform;
            transform.LookAt(AITarget);
            transform.Rotate(0, 180, 0);


            if (robotTarget == null)
            {
                return;
            }


            //if (robotTarget.robotLaborerControl.isFighter) {//if enemy Fighter
            if (robotManager.isRed != robotTarget.isRed && robotTarget.robotLaborerControl.isFighter)
            {
                //if distance is shorter then ram is distance - ram
                if (TargetDistance() < AIData.GetRamDistance())
                {
                    robotManager.robotAttack.InitiateRam();
                }
            }
        }
    }