Ejemplo n.º 1
0
 private void PutDown()
 {
     if (pickedUpRobot != null)
     {
         gem.TriggerEvent("PutDown", pickedUpRobot.gameObject);
         isCarrying    = 0;
         pickedUpRobot = null;
     }
     else
     {
         isCarrying = 0;
     }
     StartCoroutine("PuttingDown");
 }
Ejemplo n.º 2
0
    void Awake()
    {
        List <Type>          depTypes = ProgramUtils.GetMonoBehavioursOnType(this.GetType());
        List <MonoBehaviour> deps     = new List <MonoBehaviour>
        {
            (gem = FindObjectOfType(typeof(GlobalEventManager)) as GlobalEventManager)
        };

        if (deps.Contains(null))
        {
            throw ProgramUtils.DependencyException(deps, depTypes);
        }
        basicRobot    = GetComponent <BasicRobot>();
        currentRepair = maxRepair;
        if (GetComponent <BasicRobot>() == null)
        {
            engineerRobot = GetComponent <EngineerRobot>();
        }
    }
Ejemplo n.º 3
0
    //void OnCollisionStay(Collision other)
    //{
    //    Debug.Log("Picking up robot: " + other.gameObject.name);
    //    if(isCarrying == 1 && Input.GetKey(KeyCode.Space) && other.gameObject.tag == "Robot")
    //    {
    //        pickedUpRobot = other.gameObject.GetComponent<BasicRobot>();
    //        if (pickedUpRobot != null)
    //        {
    //            gem.TriggerEvent("PickUp", other.gameObject, new List<object> { hand });
    //        }
    //        else if (other.gameObject.GetComponent<EngineerRobot>() != null)
    //        {
    //            gem.TriggerEvent("PickUp", other.gameObject, new List<object> { hand });
    //        }

    //        isCarrying = 0;
    //        gem.TriggerEvent("GrabbedRobot", other.gameObject);
    //        StartCoroutine("PickingUp");
    //    }
    //}

    private void OnTriggerStay(Collider other)
    {
        if (isCarrying == 1 && Input.GetKey(KeyCode.Space) && other.gameObject.tag == "Robot")
        {
            Debug.Log("Triggering by: " + other.gameObject.name);
            pickedUpRobot = other.gameObject.GetComponent <BasicRobot>();
            if (pickedUpRobot != null)
            {
                gem.TriggerEvent("PickUp", other.gameObject, new List <object> {
                    hand
                });
            }
            else if (other.gameObject.GetComponent <EngineerRobot>() != null)
            {
                gem.TriggerEvent("PickUp", other.gameObject, new List <object> {
                    hand
                });
            }

            isCarrying = 0;
            gem.TriggerEvent("GrabbedRobot", other.gameObject);
            StartCoroutine("PickingUp");
        }
    }
Ejemplo n.º 4
0
 void OnEnable()
 {
     robot = (BasicRobot)target;
 }
Ejemplo n.º 5
0
 public BasicRobotBuilder()
 {
     robot = new BasicRobot();
 }