At() public method

public At ( Vector3 here, int amount ) : void
here Vector3
amount int
return void
示例#1
0
    public void Damage()
    {
        durability--;         //Subtract one point from durability on hit

        //If durability is zero, play animation if it exists, drop cash, and destroy object
        if (durability <= 0)
        {
            if (breakAnimator != null)              //Do this if animator exists
            {
                if (breakSound != null)
                {
                    AudioSource.PlayClipAtPoint(breakSound, transform.position);
                }
                if (dropCash)                  //Drop cash if true
                {
                    money.At(new Vector3(transform.position.x, transform.position.y - 2, transform.position.z), Random.Range((int)(1 * Multiplier.moneyDrop), (int)(5 * Multiplier.moneyDrop)));
                }
                breakAnimator.Play("Bin_Opening");
                gameObject.GetComponent <Collider2D>().enabled = false;
                dropCash = false;
            }
            else                  //Do this if there is no animator to play
            {
                if (dropCash)     //Drop cash if true
                {
                    money.At(transform.position, Random.Range((int)(1 * Multiplier.moneyDrop), (int)(5 * Multiplier.moneyDrop)));
                }
                Destroy(gameObject);
            }
        }
    }
示例#2
0
 virtual public void Hurt(float damage)
 {
     State   = EnemyState.ATTACK;
     health -= damage;
     if (health <= 0)
     {
         money.At(transform.position, Random.Range((int)(1 * Multiplier.moneyDrop), (int)(6 * Multiplier.moneyDrop)));
         HYPECounter.incrementHype(true);             //Increment HYPE on kill
         Destroy(gameObject);
     }
 }
示例#3
0
 void OnTriggerEnter2D(Collider2D hit)
 {
     if (hit.gameObject.tag == "Player")
     {
         AudioSource.PlayClipAtPoint(kaChing, transform.position);
         try {
             Vector3 vaultLoc = trainSpawn.GetComponent <trainSpawner>().headVault();
             int     repeat   = (int)Random.Range(30 * Multiplier.safeDrop, 60 * Multiplier.safeDrop);            //spawn coins between 30 and 60
             while (repeat > 0)
             {
                 money.At(vaultLoc, 1);
                 repeat--;
             }
             money.At(vaultLoc, 25);
             //play open safe animation
         } catch {
             Debug.Log("No vault in current car");
         }
         Destroy(gameObject);
     }
 }
示例#4
0
 virtual public void Hurt(float damage)
 {
     if (State == DinoState.IDLE)
     {
         State = DinoState.ATTACK;
     }
     health -= damage;
     if (health <= 0)
     {
         money.At(transform.position, Random.Range((int)(10 * Multiplier.moneyDrop), (int)(50 * Multiplier.moneyDrop)));
         HYPECounter.incrementHype(true);             //Increment HYPE twice for big kill
         HYPECounter.incrementHype(true);
         Destroy(gameObject);
     }
 }