Exemplo n.º 1
0
    void CheckCollision(Collision coll)
    {
        GameObject collObj = coll.gameObject;

        if (collObj.tag == "Ally")
        { //|| collObj.tag == "Player")
            master.screenshake.Shake(AllyScreenshakeStrength, AllyScreenshakeTime);
            MoveMotor motor = collObj.GetComponent <MoveMotor>();

            GameObject pointObject = Instantiate(PointLoseParticle, collObj.transform);
            pointObject.transform.parent           = pointObject.transform.parent.parent;
            pointObject.transform.localEulerAngles = Vector3.zero;

            motor.DieAlly();
        }

        /* else if (collObj.tag == "NPC")
         * {
         *   MoveMotor motor = collObj.GetComponent<MoveMotor>();
         *   motor.DieNPC();
         * }*/

        else if (collObj.tag == "Player" && !playerDied)
        {
            playerDied = true;
            master.screenshake.Shake(playerScreenshakeStrength, playerScreenshakeTime);
            collObj.active = false;



            GameObject particleObject = Instantiate(PlayerDeathParticle, collObj.transform);
            particleObject.transform.parent = transform.root;
            particleObject.transform.GetChild(0).GetComponent <ParticleSystem>().Emit(1);



            master.saveHandler.EndGame("DEATH", 1);
        }


        if (collObj.tag != "Enemy")
        {
            GameObject particleObj = Instantiate(explodeParticles, transform);
            particleObj.transform.parent = transform.parent;
            particleObj.GetComponent <ParticleSystem>().Emit(10);

            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
 void Mod_Punishing()
 {
     if (mode == NPCMode.ALLY)
     {
         //kill the npc occasionally
         mod_punishing_counter += Time.deltaTime;
         if (mod_punishing_counter >= mod_punishing_interval)
         {
             mod_punishing_counter = 0;
             if (Random.Range(0, 5) == 1)
             {
                 motor.DieAlly();
             }
         }
     }
 }