Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Main Cube")
     {
         mainCharacter character = other.gameObject.GetComponent <mainCharacter>();
         if (!character.isPowerful())
         {
             character.becomePowerful(timeActive);
             Destroy(gameObject);
         }
     }
 }
Example #2
0
    // Use this for initialization
    void Awake()
    {
        player     = GameObject.FindGameObjectWithTag("Player").GetComponent <mainCharacter>();
        audioPlay  = GameObject.FindGameObjectWithTag("AudioPlay").GetComponent <AudioPlay>();
        text       = GameObject.FindGameObjectWithTag("PairUI").GetComponent <Text>();
        gameOverUI = GameObject.FindGameObjectWithTag("GameOver");
        inGameUI   = GameObject.FindGameObjectWithTag("InGame");
        Debug.Log(GameObject.FindGameObjectWithTag("FinalText"));

        finalText = GameObject.FindGameObjectWithTag("FinalText").GetComponent <Text>();
        finalText.gameObject.SetActive(false);
        text.text = textPrefix + numOfPairs;
    }
Example #3
0
    public IEnumerator Hugging()
    {
        if (!mainC)
        {
            mainC = GameManager.player;
        }
        Vector3 relativeToPlayer = mainC.transform.position - transform.position;

        while (isHugging)
        {
            transform.position = mainC.transform.position - relativeToPlayer;
            yield return(null);
        }
    }
Example #4
0
    public void Hug(GameObject gameObject)
    {
        Debug.Log("Hug " + gameObject);
        mainCharacter mc = gameObject.GetComponent <mainCharacter>();

        if (!isHugging && mainCharacter.state != mainCharacter.MainCharacterGameState.CaughtByDude)
        {
            isHugging = true;
            anim.SetBool("Hug", true);
            //transform.SetParent(gameObject.transform);
            StartCoroutine("Hugging");
            gameObject.GetComponent <mainCharacter>().enterCaughByDude();
        }
    }
Example #5
0
 private void OnCollisionEnter(Collision collision)
 {
     speed = 0 - speed;
     if (collision.gameObject.name == "Main Cube")
     {
         mainCharacter mc = collision.gameObject.GetComponent <mainCharacter>();
         if (mc.isPowerful())
         {
             Destroy(this.gameObject);
         }
         else
         {
             mc.decreaseLives();
         }
     }
 }
Example #6
0
    void OnTriggerEnter(Collider other)
    {
        if (!mainC)
        {
            mainC = GameManager.player;
        }



        if (mainC.isAttack && other.CompareTag("Punch"))
        {
            ReceiveDamage(mainC.punchDmg);

            GameManager.audioPlay.PlayRandomSound(aus, punchClips);

            GameObject bloodP = Instantiate(bloodParticle, transform.position, Quaternion.identity) as GameObject;
            Destroy(bloodP, 10f);
        }
    }