Ejemplo n.º 1
0
    /// <summary>
    /// Handles the errors start.
    /// </summary>
    void HandleErrorsStart()
    {
        _ai  = GetComponent <RobotAI>();
        _rcd = GetComponent <RobotCountToDeath>();

        if (_rcd == null)
        {
            Debug.LogError("ERROR! Set the RobotCountToDeath Script in the prefab.");
        }
        if (_ai == null)
        {
            Debug.LogError("ERROR! Set the RobotAI Script in the prefab.");
        }
        _rm = GetComponent <RobotMovement>();
        if (_rm == null)
        {
            Debug.LogError("ERROR! Set the RobotMovement Script in the prefab.");
        }
        _op = GetComponent <ObjectPicking>();
        if (_op == null)
        {
            Debug.LogError("ERROR! Set the ObjectPicking Script in the prefab.");
        }
        if (gameManager == null)
        {
            Debug.LogError("ERROR! Set the GameManager object when spawning.");
        }

        _gm           = gameManager.GetComponent <GameManager>();
        _colorOfRobot = robotColor;
    }
Ejemplo n.º 2
0
    void ChangeRobotAI()
    {
        RobotState state = RobotState.Walk;
        if (lastAI != null)
            state = lastAI.GetNextState ();

        RobotAI ai;
        switch (state) {
        case RobotState.Sleep:
            ai = new RobotAISleep();
            break;
        case RobotState.Wake:
            ai = new RobotAIWake();
            break;
        case RobotState.Walk:
            ai = new RobotAIWalk();
            break;
        case RobotState.Run:
            ai = new RobotAIRun();
            break;
        case RobotState.Sniffer:
            ai = new RobotAIWalk();
            break;
        default:
            ai = new RobotAIWalk();
            break;
        }

        if(lastAI != null)
            lastAI.Finish ();

        ai.Start(this);
        lastAI = ai;
    }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     rabo = transform.parent.parent.GetComponent <RobotAI>();
     Material[] lol = GetComponent <MeshRenderer>().materials;
     blueFill   = lol[0];
     yellowFill = lol[3];
     redFill    = lol[1];
     greenFill  = lol[2];
 }
    void OnTriggerStay2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            print("moving");
            robotAi = transform.parent.GetComponent <RobotAI>();

            robotAi.MoveAttack();
        }
    }
 void Start()
 {
     robotAI = transform.parent.GetComponent<RobotAI>();
 }
Ejemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     IA    = transform.parent.GetComponent <RobotAI>();
     gm    = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
     light = transform.GetComponent <Light>();
 }
Ejemplo n.º 7
0
 void Awake()
 {
     _rm = Robot.GetComponent <RobotBehaviour>();
     _ra = Robot.GetComponent <RobotAI>();
 }