蘑菇森林:logic

本文深入探讨了蘑菇森林中蕴含的逻辑规律,从生态系统的平衡到物种间的相互作用,揭示了一个看似简单实则复杂的自然世界。
摘要由CSDN通过智能技术生成
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class logic : MonoBehaviour {
	public static logic sharedInstance = null;

    public string finalLevelName = "Level01";

    public GameObject hand = null;
	public GameObject weapon = null;
    public string weapon_name = null;

    public GameObject chat_Panel;

    public GameObject cherry_Panel = null;
    [HideInInspector]
    public static int cherry_num = 0;

    //public List<BackpacItem> bag_items = null;
    public ArrayList bag_items = null;

    public GameObject bag_Panel = null;
    public GameObject hand_Panel = null;

    public GameObject life_Panel = null;
    public int lifeNum = 5;

    public class weaponItem : MonoBehaviour
    {
        public string nam = null;
        public Sprite icon = null;
        public GameObject prefab = null;
        //public int numInList = 0;

        public virtual void trigger(GameObject obj)
        {//根据物体不同反应
         //logic.sharedInstance.weapon.GetComponent<weapon> ().trigger ();
        }
    }

    public void createWeapon (weaponItem item){
		if (weapon != null) {
            weapon_name = null;
            Destroy (weapon.gameObject);
		}
		GameObject new_weapon = GameObject.Instantiate (item.prefab);
        //Debug.Log("生成了");
        weapon_name = item.nam;
		new_weapon.transform.position = hand.transform.position;
		new_weapon.transform.parent = hand.transform;
        Debug.Log(new_weapon.transform.position);
        weapon = new_weapon;
	}
	public void removeWeapon (){
		if (weapon != null) {
            weapon_name = null;
            Destroy (weapon.gameObject);           
        }
	}

	//public weaponItem[] weaponList = null;

	void Awake(){
		sharedInstance = this;
       // NewItemManager.Instance.LoadItemConfigData();
        //this.bag_items = NewItemManager.Instance.BackPackItemList;     
    }
    private void Start()
    {
        hand = GameObject.Find("Hand");
        
    }

    void FixedUpdate () {
        if (life_Panel)
        {
            setLife();         
        }
        //if (bag_Panel)
        //{
        //    setGrid();
        //}
       

    }
    public void setLife()
    {
        for(int i =0; i < lifeNum; i++)
        {
            life_Panel.transform.GetChild(i).gameObject.SetActive(true);
        }
        for (int j = lifeNum; j < 5; j++)
        {
            life_Panel.transform.GetChild(j).gameObject.SetActive(false);
        }
    }
	//public void setGrid(){
	//	int it = 0;
	//	foreach(weaponItem i in bag_items){
 //           if (i != null)
 //           {
 //               bag_Panel.transform.GetChild(it).GetChild(0).GetComponent<UnityEngine.UI.Image>().sprite = i.prefab.GetComponent<SpriteRenderer>().sprite;
 //               bag_Panel.transform.GetChild(it).GetChild(0).gameObject.SetActive(true);
 //               bag_Panel.transform.GetChild(it).GetChild(0).GetComponent<DragMe>().item = i;
 //               it++;
 //           }
			
	//	}
 //       for (int j = it; j < 15; j++) {
 //           bag_Panel.transform.GetChild(j).GetChild(0).GetComponent<UnityEngine.UI.Image>().sprite = null;
 //           bag_Panel.transform.GetChild(j).GetChild(0).gameObject.SetActive(false);
 //           bag_Panel.transform.GetChild(j).GetChild(0).GetComponent<DragMe>().item = null;
 //       }

	//}
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值