示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (!isStunned())
     {
         ja.jump(1);
     }
 }
 /// <summary>
 /// Called by the EnemyBOSS script
 /// </summary>
 public void processAttack()
 {
     //Spawn enemies
     if (enemyPrefabs.Count > 0 &&
         enemiesSpawned < enemySpawnAmount &&
         Time.time > lastEnemySpawnTime + enemySpawnDelay)
     {
         enemiesSpawned++;
         lastEnemySpawnTime = Time.time;
         int        randex = Random.Range(0, enemyPrefabs.Count);
         GameObject enemy  = GameObject.Instantiate(enemyPrefabs[randex]);
         enemy.transform.position = transform.position + Vector3.up * transform.localScale.y * 2;
         enemy.GetComponent <Rigidbody>().velocity =
             rb.velocity
             + Vector3.up
             + (Vector3.right * (pc.gameObject.transform.position.x - transform.position.x));
         enemy.GetComponent <Enemy>().stun(1.5f);
         enemy.AddComponent <OnTouchDestroy>();
         SceneManager.MoveGameObjectToScene(enemy, LevelManager.Level);
     }
     if (jumpAmount > 0)
     {
         ja.jump(1);
     }
     if (movementSpeed != 0)
     {
         rb.velocity = new Vector3(Mathf.Sign(pc.gameObject.transform.position.x - transform.position.x) * movementSpeed, rb.velocity.y);
     }
 }
示例#3
0
 public void jump(float amount)
 {
     if (ridingSnail == null)
     {
         ja.jump(amount);
     }
     else
     {
         ridingSnail.jump(amount);
     }
 }
示例#4
0
 public Vector3 jump(float amount)
 {
     ja.jump(amount);
     if (ja.jumpCount == ja.maxJumpCount)
     {
         pc.rideSnail(null, false);
         playerRiding          = false;
         pc.transform.position = playerHoldPoint.transform.position + Vector3.up * 2;
         ja.cancelJump();
     }
     return(rb.velocity);
 }