Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (elapsedSlashTime < slashDuration)
     {
         elapsedSlashTime += Time.deltaTime;
         if (elapsedSlashTime > slashDuration)
         {
             slashStage = SlashStages.NeitherHit;
         }
     }
 }
Exemplo n.º 2
0
 public void OnDetectCollision(GameObject detector)
 {
     if (slashStage == SlashStages.NeitherHit)
     {
         if (detector == left)
         {
             slashStage       = SlashStages.LeftHit; //slash has begun
             elapsedSlashTime = 0;
         }
     }
     else if (slashStage == SlashStages.LeftHit)
     {
         if (detector == right)
         {
             EndMe(); //slash successful
         }
         else if (detector == left)
         {
             slashStage = SlashStages.NeitherHit; //slash unsuccessful
         }
     }
 }