Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     destruction = 0;
     spw         = spwan.GetComponent <Spwan>();
     txt         = text.GetComponent <GUIText>();
     py          = player.GetComponent <Entety>();
 }
Ejemplo n.º 2
0
 //On hit
 void OnTriggerEnter(Collider collision)
 {
     if (!Modle && collision.gameObject.name != "Bullet")
     {
         if (collision.GetComponent <Entety>() != null)
         {
             Entety e = collision.GetComponent <Entety>();
             if (e.Player != Player)
             {
                 //effect
                 if (hitting != null)
                 {
                     GameObject h = Instantiate(hitting) as GameObject;
                     h.transform.position = transform.position;
                     h.layer = 9;
                     h.GetComponent <AudioSource>().Play();
                     Destroy(h, 1f);
                 }
                 //destroy
                 Destroy(gameObject);
                 //-HP
                 e.Health -= Power;
                 //shack camra
                 if (e.Player)
                 {
                     collision.transform.GetChild(1).gameObject.GetComponent <ShackCamera>().setShack();
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 void spwanPoint_2()
 {
     if (timer == spwanInterval * enemySum)
     {
         enemySum++;
         //================================ spwan enemy ================================\\
         //set position and rotation and layer
         Vector3    pos    = new Vector3(Random.Range(-14f, 14f), Random.Range(-9f, 9f), 5f);
         GameObject Enemy1 = Instantiate(EnemyModle[0], pos, Quaternion.Euler(Vector3.zero)) as GameObject;
         Enemy1.transform.parent = transform;
         //set entety
         Entety ent = Enemy1.GetComponent <Entety>();
         ent.Health = 13f * Mathf.Pow(enemyHealth, level);
         ent.Modle  = false;
         //set enemy movement
         EnemyMovement em = Enemy1.GetComponent <EnemyMovement>();
         em.MoveType = 5;
         em.Speed    = 2.5f * Mathf.Pow(enemySpeed, level);
         //set bullet
         //set bullet
         BulletBehavior bb = BulletModle[2].GetComponent <BulletBehavior>();
         bb.Speed = 7.5f * Mathf.Pow(bulletSpeed, level);
         bb.Power = 1f * Mathf.Pow(bulletPower, level);
         //set enemy1BH
         Enemy1BH e1 = Enemy1.GetComponentInChildren <Enemy1BH>();
         e1.Bullet         = BulletModle[2];
         e1.NumberOfBullet = (int)(15f * Mathf.Pow(bulletNumber, level));
         e1.AttackInterval = (int)(100f * Mathf.Pow(attackInterval, level));
         //==============================================================================\\
         //spwan end
         if (enemySum >= (int)(7f * Mathf.Pow(enemyNumber, level)))
         {
             spwanPoint = 0;
             timer      = 0;
         }
     }
     timer++;
 }
Ejemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     e       = GetComponentInParent <Entety>();
     trigger = false;
     Modle   = GetComponentInParent <Entety>().Modle;
 }