Esempio n. 1
0
    public override bool die()
    {
        deathMaterial.SetFloat("_Period", deathTime);
        deathMaterial.SetFloat("_StartTime", Time.fixedTime);
        var ren = transform.GetComponentsInChildren <Renderer>();

        foreach (var r in ren)
        {
            r.material = deathMaterial;
        }
        //GetComponent<Renderer>().material = deathMaterial;
        if (RightWeapon != null)
        {
            RightWeapon.DropWeapon();
        }
        if (LeftWeapon != null)
        {
            LeftWeapon.DropWeapon();
        }
        if (rb != null)
        {
            rb.Sleep();
        }
        if (isEDF)
        {
            GetComponent <CapsuleCollider>().enabled = false;
        }
        Destroy(gameObject, deathTime);
        this.enabled = false;
        return(true);//base.die();
    }
Esempio n. 2
0
 /// <summary>
 /// <paramref name="picked"/>を拾う
 /// </summary>
 /// <param name="picked">拾うWeapon</param>
 public void PickUpWeapon(Weapon picked)
 {
     //枠がいっぱいなら手持ちと交換
     if (WeaponList.Count >= 2)
     {
         int index = WeaponList.FindIndex(match => RightWeapon == match);
         WeaponList[index] = picked;
         RightWeapon.DropWeapon();
         picked.HaveWeapon();
         RightWeapon = picked;
     }
     //何も持ってなかったらすぐ装備
     else if (RightWeapon == null && WeaponList.Count < 2)
     {
         WeaponList.Add(picked);
         picked.HaveWeapon();
         RightWeapon = picked;
         if (LeftWeapon != null)
         {
             LeftWeapon.isHave = false;
         }
     }
     //何か持ってて枠が空いてたら装備せずに拾う
     else if (RightWeapon != null && WeaponList.Count < 2)
     {
         WeaponList.Add(picked);
         picked.PickWeapon();
     }
     uiController.SlotUpdate(WeaponList);
     uiController.SetActiveSlot(WeaponList.FindIndex(m => m == RightWeapon));
 }