예제 #1
0
    /// <summary>
    /// 初始化角色
    /// </summary>
    public void Init()
    {
        GM = GameObject.FindWithTag("GameManager").GetComponent <GameManager>();

        string _dbName = Dict.SqlDBName;

        OriginPos   = new Vector2Int(System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["heroTilePosX"][1]), System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["heroTilePosY"][1]));
        ResPath     = Dict.GetString(_dbName, "system_res", "res", 2);
        MGameObject = (GameObject)Object.Instantiate(Resources.Load(ResPath)) as GameObject;
        MGameObject.transform.SetParent(GM.GetMap().Path.transform);
        MGameObject.transform.position = new Vector3(OriginPos.x, OriginPos.y);
        MGameObject.AddComponent <DOTweenAnimation>();
        MAnimator = MGameObject.GetComponent <Animator>();
        MAnimator.SetInteger("direction", System.Convert.ToInt32(Dict.GetAllDict()[Dict.SaveDBName]["z_save_in_map"]["heroDir"][1]));
        MAnimator.SetLayerWeight(0, 1);
        //图形层级
        if (MGameObject.GetComponent <SpriteRenderer>())
        {
            MGameObject.GetComponent <SpriteRenderer>().sortingOrder = 3;
        }

        if (Application.isEditor)
        {
            MGameObject.tag = "Player";
        }
    }
예제 #2
0
 public void addMouseEventsReceiver(MGameObject _mGameObject)
 {
     mouseEventsReceivers.Add(_mGameObject);
 }
예제 #3
0
 public void SetActiveEx(bool isShow)
 {
     MGameObject.SetActiveEx(isShow);
 }