示例#1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         gem.TriggerEvent("Exit", other.gameObject);
     }
 }
 void Update()
 {
     if (healthPoints < 1 && dying == null)
     {
         gem.TriggerEvent("HooliganDie", gameObject);
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform.CompareTag("Player"))
     {
         gem.TriggerEvent("RobberEnteredSpawnArea", other.gameObject);
     }
 }
示例#4
0
 void OnCollisionEnter(Collision other)
 {
     if (other.transform.CompareTag("Player"))
     {
         collided = true;
         gem.TriggerEvent("Shot", other.gameObject);
     }
 }
    private void OnTriggerEnter(Collider other)
    {
        if (attacking != null)
        {
            return;
        }
        Flag flag = other.transform.GetComponent <Flag>();

        if (flag != null)
        {
            if (flag.gameObject.name == "BombRoomCenterPosition")
            {
                gem.TriggerEvent("Explode", gameObject);
            }
            walkTarget = flag.nextFlag;
        }
    }
示例#6
0
    private IEnumerator SpawnRobbers()
    {
        yield return(new WaitForSeconds(1));

        gem.TriggerEvent("RobbersSelected", gameObject, new List <object> {
            new Queue <GameObject>(TEST_SPAWN_ROBBERS)
        });
    }
    void OnCollisionStay(Collision other)

    {
        if (other.gameObject.CompareTag("Player"))
        {
            gem.TriggerEvent("StoleVault", other.gameObject);
            //Destroy(gameObject);
        }
    }
示例#8
0
    private void AttemptStartGame(GameObject target, List <object> parameters)
    {
        if (parameters.Count == 0)
        {
            throw new Exception("Missing parameter: Could not find list of robbers");
        }
        if (parameters[0].GetType() != typeof(List <GameObject>))
        {
            throw new Exception("Illegal argument: parameter wrong type: " + parameters[0].GetType().ToString());
        }

        Queue <GameObject> robbers = new Queue <GameObject>((List <GameObject>)parameters[0]);

        gem.TriggerEvent("StartGame", gameObject);
        gem.TriggerEvent("RobbersSelected", gameObject, new List <object> {
            robbers
        });
    }
示例#9
0
    private void DropMoney(GameObject target, List <object> parameters)
    {
        if (target != gameObject)
        {
            return;
        }
        backpack.SetActive(false);
        GameObject    clone  = Instantiate(backpackPrefab, backpack.transform.position, backpack.transform.rotation);
        MoneyNotifyer script = clone.GetComponent <MoneyNotifyer>();

        if (script == null)
        {
            throw new Exception("Did not find MoneyNotifyer on backpack prefab");
        }
        script.amount = money;
        money         = 0;
        gem.TriggerEvent("UpdateMoney", gameObject);
    }
示例#10
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform.CompareTag("Player"))
     {
         Debug.Log("Registered OnTriggerEnter!: " + other.transform.name);
         gem.TriggerEvent("RobberEnteredRoom", gameObject, new List <object> {
             other.gameObject
         });
     }
 }
示例#11
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.CompareTag("Player"))
     {
         Debug.Log("Touched money!: " + collision.transform.name);
         gem.TriggerEvent("AddMoneyToRobber", collision.gameObject, new List <object> {
             amount
         });
         Destroy(gameObject);
     }
 }
示例#12
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.CompareTag("Player"))
     {
         gem.TriggerEvent("AddMoneyToRobber", collision.gameObject, new List <object> {
             amount
         });
         // triggers event in MoneyBag
         Destroy(gameObject);
     }
 }
示例#13
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform.CompareTag("Player"))
     {
         if (!nearbyRobbers.Contains(other.gameObject))
         {
             nearbyRobbers.Add(other.gameObject);
         }
         Debug.Log("EscapeWithMoney");
         gem.TriggerEvent("EscapeWithMoney", other.gameObject, nearbyRobbers.Select(robber => (object)robber).ToList());
     }
 }
示例#14
0
    public void BeginUnlocking(GameObject target, List <object> parameters)
    {
        if (target != gameObject)
        {
            return;
        }

        gem.TriggerEvent("BeginUnlocking", gameObject, new List <object> {
            unlockingSpeed
        });
        Debug.Log("gem.TriggerEvent(\"BeginUnlocking\", gameObject, new List<object> { unlockingSpeed });");
    }
示例#15
0
    private void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            gem.TriggerEvent("Space", gameObject);
        }
        if (Input.GetKeyDown("e"))
        {
            gem.TriggerEvent("E", gameObject);
            Debug.Log("gem.TriggerEvent(\"E\", gameObject);");
        }
        if (Input.GetMouseButtonDown(0))
        {
            //getting mouse location in space
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            List <GameObject> robbers = Physics.RaycastAll(ray)
                                        .Where(hit => hit.transform.CompareTag("Player"))
                                        .Select(hit => hit.transform.gameObject)
                                        .ToList();
            gem.TriggerEvent("LeftClick", gameObject, new List <object> {
                robbers
            });
        }
        if (Input.GetMouseButtonDown(1))
        {
            //getting mouse location in space
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            //if found a spot, move player there
            if (Physics.Raycast(ray, out hit))
            {
                Vector3 location = hit.point;
                gem.TriggerEvent("RightClick", gameObject, new List <object> {
                    location
                });
            }
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        if (attacking != null)
        {
            return;
        }
        Flag flag = other.transform.GetComponent <Flag>();

        if (flag != null)
        {
            if (flag.gameObject.name == "BombRoomCenterPosition")
            {
                gem.TriggerEvent("Explode", gameObject);
            }
            if (flag.nextFlag.gameObject.name == "BombRoomCenterPosition")
            {
                walkTarget = flag.nextFlag.gameObject;
            }
            else
            {
                walkTarget = flag.nextFlag.transform.GetChild(UnityEngine.Random.Range(0, transform.childCount)).gameObject;
            }
        }
    }
示例#17
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");
        }
    }
示例#18
0
    public void UpdateRobberLocation(GameObject target, List <object> parameters)
    {
        if (parameters.Count == 0)
        {
            throw new Exception("Missing parameter: Could not find robber game object");
        }
        if (parameters[0].GetType() != typeof(GameObject))
        {
            throw new Exception("Illegal argument: parameter wrong type");
        }
        GameObject robber = (GameObject)parameters[0];

        robberToRoomMap[robber] = target;
        gem.TriggerEvent("NotifyLocationChanged", robber);
    }
示例#19
0
    public void TakeDamage(GameObject target, List <object> parameters)
    {
        if (target != gameObject)
        {
            return;
        }

        health -= 1;
        if (health == 0)
        {
            animator.SetBool("isDead", true);
            gameObject.tag = "Corpse";
            gem.TriggerEvent("Death", gameObject);
        }
    }
示例#20
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.transform.CompareTag("Player"))
        {
            if (!nearbyRobbers.Contains(other.gameObject))
            {
                nearbyRobbers.Add(other.gameObject);
            }
            //Debug.Log("EscapeWithMoney");

            //goes to EscapeWithMoney() in game mananger SCript (bottom)
            gem.TriggerEvent("EscapeWithMoney", other.gameObject, nearbyRobbers.Select(robber => (object)robber).ToList());
            // triggers event in GameManager
        }
    }
 private void TakeDamage(float damageTaken, bool destroy)
 {
     health -= damageTaken;
     if (health < 0)
     {
         if (destroy)
         {
             Destroy(gameObject);
         }
         else
         {
             gem.TriggerEvent("RobotBreak", gameObject);
             health = maxHealth;
         }
     }
 }
    private void PushEverythingAway()
    {
        gem.TriggerEvent("Stop", gameObject);
        List <GameObject> gos = (FindObjectsOfType(typeof(GameObject)) as GameObject[]).ToList();

        foreach (GameObject go in gos)
        {
            if (go.transform.CompareTag("Robot") || go.transform.CompareTag("Hooligans") || go.transform.CompareTag("Player"))
            {
                Vector3 diff = transform.position - go.transform.position;

                Rigidbody rigidbody = go.GetComponent <Rigidbody>();
                rigidbody.constraints = 0;
                rigidbody.AddExplosionForce(5000, transform.position, 100);
            }
        }
    }
示例#23
0
    public void TakeDamage(GameObject target, List <object> parameters)
    {
        if (target != gameObject)
        {
            return;
        }

        health -= 1;
        if (health == 0)
        {
            animator.SetBool("isDead", true);
            gameObject.tag = "Corpse";
            gem.TriggerEvent("Death", gameObject);
            // triggers event in a lot of places,
            // GameManager, SelecedManager, CorpseLeaving, MoneyBag, Movement, Unlocking
            // basically all the places that need to be stopped or removed from a list when someone dies
            // and the money being dropped ofc
        }
    }
    // Update is called once per frame
    void Update()
    {
        //displays image over button
        // Only go into this if statement
        // if the player has enough money to buy anything to begin with
        if (robberNum > -1 && slotNum > -1)
        {
            button = buttonList[slotNum];
            if (CheckIfEnoughMoney(robberNum, slotNum) == false)
            {
                robberNum = -1;
                slotNum   = -1;
                button.transform.GetChild(1).gameObject.SetActive(false);
                button.transform.GetChild(0).gameObject.SetActive(false);
                return;
            }
            if (selectedRobbers[slotNum] != null)
            {
                StaticMoney.AddMoney(GetRobberCost(selectedRobbers[slotNum]));
            }
            StaticMoney.RemoveMoney(GetNewRobberCost(robberPrefabs[robberNum]));
            gem.TriggerEvent("SetSelectionMoney", gameObject, new List <object> {
                StaticMoney.GetMoneyCount()
            });
            button.image.sprite      = robberList[robberNum];
            selectedRobbers[slotNum] = robberPrefabs[robberNum];
            button.transform.GetChild(1).gameObject.SetActive(false);
            button.transform.GetChild(0).gameObject.SetActive(false);

            //shows next button
            //TODO: dont show button if player can't afford
            if (slotNum < 3)
            {
                button = buttonList[slotNum + 1];
                button.transform.gameObject.SetActive(true);
            }

            //reset
            robberNum = -1;
            slotNum   = -1;
        }
    }
示例#25
0
    private IEnumerator LoseGame()
    {
        yield return(new WaitForSeconds(1));

        gem.TriggerEvent("LostGame", gameObject);
    }