Inheritance: MonoBehaviour
Exemplo n.º 1
0
    /// <summary>
    /// 技能冷却检测
    /// </summary>
    /// <returns></returns>
    public bool CheckSkillCD()
    {
        if (mSkillProperty == null)
        {
            return(false);
        }

        float spaceTime = mSkillProperty.mSkillSpace;

        if (spaceTime < 0.0f)
        {
            return(false);
        }

        if (mSkillLastTime > 0.0f && Time.time - mSkillLastTime < spaceTime)
        {
            return(false);
        }

        mSkillLastTime = Time.time;

        // 如果当前技能是主角技能
        if (mSelfObj is CRoleObject)
        {
            FightUI ui = FightManager.Instance.mFightUI;
            if (ui != null)
            {
                ui.SetSkillCD(mSkillId, spaceTime);
            }
        }

        return(true);
    }
Exemplo n.º 2
0
 void Start()
 {
     cellLayer    = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/cell").GetComponent <CellLayer>();
     lineLayer    = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/line").GetComponent <LineLayer>();
     monsterLayer = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/monster").GetComponent <MonsterLayer>();
     fightUI      = GameObject.Find("Canvas/layer_0/FightModule/fightUI").GetComponent <FightUI>();
 }
Exemplo n.º 3
0
 void OnEnable()
 {
     controll.enabled = false;
     state            = playerCreature.initiative > enemy.initiative ? TurnState.PLAYER : TurnState.ENEMY;
     fight            = GetComponent <FightUI>();
     fight.player     = playerCreature;
     fight.setUpAttackButtons();
     fight.updateHealth();
 }
Exemplo n.º 4
0
    void Init()
    {
        PlayerData PD = PlayerData.Get(1); //卡组数据库

        AddCoreA(PD.Core);                 //设置核心
        DeckListA.Deck.AddRange(PD.Deck);  //设置卡组
        FightU = FightUI.Instance;         //获取UI?
        FightU.Init();
    }
Exemplo n.º 5
0
    void Start()
    {
        fightUI        = GameObject.Find("Canvas/layer_0/FightModule/fightUI").GetComponent <FightUI>();
        floorLayer     = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/floor").GetComponent <FloorLayer>();
        coverLayer     = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/cover").GetComponent <CoverLayer>();
        fancelayer     = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/fence").GetComponent <FanceLayer>();
        floorHideLayer = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/floor_hide").GetComponent <FloorHideLayer>();
        monsterLayer   = GameObject.Find("Canvas/layer_0/FightModule/layers/fight_mask/animLayer/monster").GetComponent <MonsterLayer>();
        effectLayer    = GameObject.Find("Canvas/layer_0/FightModule/layers/effect").GetComponent <EffectLayer>();
        fightModule    = GameObject.Find("Canvas/layer_0/FightModule").GetComponent <FightModule>();

        PropModel.Instance.PropRefreshEvent     = PropRefreshEvent;
        PropModel.Instance.PropChangeCellsEvent = PropChangeCellsEvent;
    }
    public void Enter(GameStateBase owner)
    {
        underpantNum = 0;
        braNum       = 0;
        m_owner      = (GameStart)owner;
        m_isFailed   = false;
        m_isVectory  = false;
        //
        GameObject prefab = Resources.Load("UI/FightCanvas") as GameObject;
        GameObject go     = GameObject.Instantiate(prefab);

        m_uiCtr          = go.GetComponent <FightUI>();
        m_countDownTotal = GameData.CurLevel.countDown;
        m_countDownCur   = m_countDownTotal;
        m_uiCtr.SetCountDown((int)m_countDownCur, m_countDownTotal);
        //
        GameObject failPrefab = Resources.Load("UI/FailureCanvas") as GameObject;
        GameObject fail       = GameObject.Instantiate(failPrefab);

        m_failCtr = fail.GetComponent <FailureUI>();
        m_failCtr.gameObject.SetActive(false);
        //
        GameObject vectoryPrefab = Resources.Load("UI/VectoryCanvas") as GameObject;
        GameObject vectory       = GameObject.Instantiate(vectoryPrefab);

        m_vectoryCtr = vectory.GetComponent <VectoryUI>();
        m_vectoryCtr.gameObject.SetActive(false);
        //
        GameObject map = new GameObject();

        map.name = "map";
        m_mapCtr = map.AddComponent <MapCtr> ();
        Debug.Log("read map");
        m_mapCtr.ReadMap(GameData.CurLevel.levelFileName);
        //
        CameraFollow cameraCtr = Camera.main.GetComponent <CameraFollow>();

        cameraCtr.FollowTarget = m_mapCtr.Player.transform;
        float mapTopRightX = (m_mapCtr.Map.column - 0.5f) * (float)m_mapCtr.Map.cellWidth;
        float mapTopRightY = (m_mapCtr.Map.row - 0.5f) * (float)m_mapCtr.Map.cellHeight;

        cameraCtr.MaxPos  = new Vector2(mapTopRightX, mapTopRightY);
        cameraCtr.MaxPos -= Camera.main.orthographicSize * new Vector2(Camera.main.aspect, 1);
        Debug.Log("camera max:" + cameraCtr.MaxPos + "," + Camera.main.aspect);
        //Camera.main.GetComponent<CameraFollow>().FollowTarget = m_mapCtr.Player.transform;
        AudioManager.Instance.PlayAudio("bg", true);
    }
Exemplo n.º 7
0
    void Awake()
    {
        //Debug.Log(transform.localToWorldMatrix);
        if (_instance == null)
        {
            _instance = this;
        }
        GameObject net = GameObject.Find("NetWork");

        if (net == null)
        {
            return;
        }
        if ((fight = net.GetComponent <FightHanler>()) == null)
        {
            fight = net.AddComponent <FightHanler>();
        }
    }
Exemplo n.º 8
0
        void Start()
        {
            Board          = GetComponent <ChessBoard>();
            FightUi        = GetComponent <FightUI>();
            GameController = GetComponent <СGameController>();
            GameInput      = GetComponent <GameInput>();
            GameUI         = GetComponent <GameUI>();

            PieceInteraction.Game = this;

            _setupLevels();
            Board.Setup();

            GameData.ChoosedLevel = 3;
            _setLevel(GameData.ChoosedLevel);

            GameUI.SetMenu(MenuType.NONE);
        }
 public void Exit(GameStateBase owner)
 {
     AudioManager.Instance.StopAudio("bg");
     m_mapCtr.Clear();
     Debug.Log("clear map");
     if (null != m_uiCtr)
     {
         GameObject.Destroy(m_uiCtr.gameObject);
         m_uiCtr = null;
     }
     if (null != m_failCtr)
     {
         GameObject.Destroy(m_failCtr.gameObject);
         m_failCtr = null;
     }
     if (null != m_vectoryCtr)
     {
         GameObject.Destroy(m_vectoryCtr.gameObject);
         m_vectoryCtr = null;
     }
 }
Exemplo n.º 10
0
 void Awake()
 {
     Instance = this;
     GetUI();
 }