Beispiel #1
0
 void OnFalling()
 {
     f_fallingTime += Time.deltaTime;
     if (f_fallingTime * f_fallingTime <= f_fallTime)
     {
         trans_vec3         = f_fallingTime * fly_dir_vec3 + 0.5f * f_fallingTime * f_fallingTime * add_velocity_vec3;
         transform.position = origin_pos_vec3 + trans_vec3;
         if (!setColliderOnce && f_fallingTime * f_fallingTime > f_fallTime * 0.64f)
         {
             setColliderOnce  = true;
             collider.enabled = true;
         }
     }
     else
     {
         setColliderOnce      = false;
         f_fallingTime        = 0.0f;
         b_falling            = false;
         shadowRender.enabled = true;
         if (StageManager.currentStage == 7)
         {
             levelHeight.SetHeight();
         }
     }
 }
Beispiel #2
0
 public void InitCollects(int _type, int _itemType)
 {
     if (StageManager.currentStage == 7)
     {
         levelHieght.SetHeight();
     }
     img.color  = new Color(1, 1, 1, 0);
     type       = _type;
     itemTypes  = _itemType;
     img.sprite = appearences[type];
     StartCoroutine(ShowUp());
 }
Beispiel #3
0
 public void Idle(float _idleTime)
 {
     //Debug.Log("idle" + state_time);
     inState_time += Time.deltaTime;
     if (state_time < 0.1f)
     {
         levelHieght.SetHeight();
         state_time = _idleTime;
     }
     if (inState_time > state_time)
     {
         animator.SetTrigger("nextState");
         SetState(-1, false);
     }
     //if (inState_time > state_time) SetState(-1);
 }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     if (time < lifeTime)
     {
         if (!init)
         {
             init = true;
             levelHieght.SetHeight();
             levelHieght.isOnGround();
         }
         time += Time.deltaTime;
     }
     else
     {
         RecycleSelf();
     }
 }
Beispiel #5
0
 // Update is called once per frame
 void Update()
 {
     if (time < lifeTime)
     {
         if (!init)
         {
             init = true;
             levelHieght.SetHeight();
         }
         //time += Time.deltaTime;
     }
     else
     {
         ResetChild();
         system.AddFree(this.transform);
     }
 }
Beispiel #6
0
    public void SetProjectileImg(int _flight_way)
    {
        if (StageManager.currentStage == 7)
        {
            levelHeight.SetHeight();
        }
        if (StageNum == 1)
        {
            if (Player.weapon.id == 6) //木頭弓箭
            {
                projectile_img.sprite = ProjectileSprite[0];
            }
            else if (Player.weapon.id == 7)
            {
                projectile_img.sprite = ProjectileSprite[1];
            }
            else if (Player.weapon.id == 11)
            {
                projectile_img.sprite = ProjectileSprite[2];
            }
        }
        if (StageNum == 2)
        {
            if (Player.weapon.id == 8)
            {
                projectile_img.sprite = ProjectileSprite[0];
            }
            else if (Player.weapon.id == 10)
            {
                projectile_img.sprite = ProjectileSprite[1];
            }
        }

        //Debug.Log("setflight" + _flight_way);
        flight_way = _flight_way;
        switch (flight_way)
        {
        case 0:
            //transform.position = weapon.transform.position;
            transform.rotation = Quaternion.Euler(0, 0, -90);
            break;

        case 1:
            //transform.position = weapon.transform.position;
            transform.rotation = Quaternion.Euler(0, 0, 90);
            break;

        case 2:
            //transform.position = weapon.transform.position;
            transform.rotation = Quaternion.Euler(0, 0, 0);
            break;

        case 3:
            //transform.position = weapon.transform.position;
            transform.rotation = Quaternion.Euler(0, 0, -180);
            break;
        }
        //if (Player.outOfProjectile)
        //{
        //    GameObject.Find("PickWeapon").GetComponent<CPickWeapon>().ThrowWeapon();
        //    Player.outOfProjectile = false;
        //}
    }