Exemplo n.º 1
0
 /// <summary>
 /// 使用此快捷栏中的技能
 /// </summary>
 /// <returns>使用成功返回 true</returns>
 public bool UseSkill()
 {
     //没有技能的情况
     if (this.id == 0)
     {
         Debug.Log("没有快捷技能");
         return(false);
     }
     //cd没好的情况
     else if (!SkillBoard.Instance().FindSkillById(id).GetSkillReadyState())
     {
         Debug.Log("CD未冷却");
         return(false);
     }
     //mp不够的情况
     else if (!PlayerStatusManager.Instance().ReduceMp(this.info.mpSpend))
     {
         Debug.Log("蓝不够");
         return(false);
     }
     //没有以上情况则释放技能
     else
     {
         //使技能进入冷却
         SkillBoard.Instance().FindSkillById(id).SetSkillColdState();
         //技能发射器发射技能
         SkillShoot.Instance().ShootSkill(this.id, this.info);
         return(true);
     }
 }
Exemplo n.º 2
0
        public override void InitCharacter(Vector3 position)
        {
            var playerIndex = ((Player)possessedBy)?.GetPlayerIndex();

            if (playerIndex != null)
            {
                Rectangle characterStartPos = scene.CharacterStartPos[(int)playerIndex];
                SetSize(new Vector3(characterStartPos.Width, characterStartPos.Height, 0f));
            }
            else
            {
                // i.e. for AI
                if (rep is Spritesheet)
                {
                    Spritesheet repSpritesheet = (Spritesheet)rep;
                    rep.SetSize(new Vector3(repSpritesheet.SpriteWidth, repSpritesheet.SpriteHeight, 0f));
                    SetSize(new Vector3(repSpritesheet.SpriteWidth, repSpritesheet.SpriteHeight, 0f));
                }
            }

            SetPosition(position);

            CharacterPhysics = new CharacterPhysics(this, position, size, HitboxOffset, scene);

            (rep as Spritesheet)?.SetVisibilityLayer(1, false);

            skillShoot   = new SkillShoot(scene, this, CharacterPhysics, CharacterConfig.SKILL_COOLDOWN_SHOOT);
            skillCut     = new SkillCut(scene, this, CharacterPhysics, CharacterConfig.SKILL_COOLDOWN_CUT);
            skillCollect = new SkillCollect(scene, this, CharacterPhysics, CharacterConfig.SKILL_COOLDOWN_COLLECT);
            skillTrap    = new SkillTrap(scene, this, this.CharacterPhysics, CharacterConfig.SKILL_COOLDOWN_TRAP);

            characterTreasureLostEventList = new GameEventList();
            TrapDropEventList = new GameEventList();

            AddTrap();
        }
Exemplo n.º 3
0
	void Awake()
	{
		_instance = this;
	}