Exemplo n.º 1
0
 void Spawn()
 {
     if (SC.isSpacekeyPushed)
     {
         GameObject  bullet = Instantiate(Bullet, new Vector3(player_pos_x, player_pos_y + 1, player_pos_z), Quaternion.Euler(0, 90 * player_move.toward, 0)) as GameObject;
         BulletEvent BE     = bullet.GetComponent <BulletEvent>();
         bullet.GetComponent <Rigidbody>().velocity = new Vector3(dx [player_move.toward] * (BE.speed + player_move.speed), 0, dy [player_move.toward] * (BE.speed + player_move.speed));
         bullet.transform.localScale *= BE.size;
         BE.SetPlayer(Player);
         bullet.tag = Player.tag;
         //Debug.Log(bullet.tag);
         //     BulletSound.PlayOneShot(BulletSound.clip);
         if (PS.Weapon == "Tomato")
         {
             BulletSounds[2].PlayOneShot(BulletSounds[2].clip);
         }
         else if (PS.Weapon == "Banana")
         {
             BulletSounds[3].PlayOneShot(BulletSounds[3].clip);
         }
         else if (PS.Weapon == "Cherry")
         {
             BulletSounds[4].PlayOneShot(BulletSounds[4].clip);
         }
         shot_interval   = BE.CoolDownTime;
         d_shot_interval = shot_interval;
     }
 }
Exemplo n.º 2
0
    private void TriggerEvent()
    {
        //print("trigger: " + nextEventToExecute.GetType());
        MoveEvent me = nextEventToExecute as MoveEvent;

        if (me != null)
        {
            //print("clone is moving");
            Main_Move(me.MoveData);
            cloneEventIndex++;
        }

        JumpEvent je = nextEventToExecute as JumpEvent;

        if (je != null)
        {
            //print("clone is jumping");
            Main_Jump(je.JumpData);
            cloneEventIndex++;
        }

        DropEvent de = nextEventToExecute as DropEvent;

        if (de != null)
        {
            //print("clone is dropping");
            Main_Drop();
            cloneEventIndex++;
        }

        BulletEvent be = nextEventToExecute as BulletEvent;

        if (be != null)
        {
            //print("clone is bulleting");
            Main_Action(be.MouseScreenPos);
            cloneEventIndex++;
        }

        if (gameManager.listEvents.Count > cloneEventIndex)
        {
            nextEventToExecute = gameManager.listEvents[cloneEventIndex];
        }
    }