public override void Update(GameTime gameTime) { // unknown => inprocess if (_state == state.Unknown) { foreach (var entity in ActiveEntities) { _battle = _battleMapper.Get(entity); if (_battle != null) { setInProcessState(entity); return; } } } else // inprocess => won/lose => unknown if (_state == state.InProcess) { if (isAllEnemiesDead()) { setWinState(); } else if (isPlayerDead()) { setLoseState(); } } }
public void AddComponent(string componentType, string componentJSON) { switch (componentType) { case "AbstractFighter": AbstractFighter abstractFighter = GetComponent <AbstractFighter>(); if (abstractFighter == null) { abstractFighter = gameObject.AddComponent <AbstractFighter>(); } JsonUtility.FromJsonOverwrite(componentJSON, abstractFighter); break; case "ActionHandler": ActionHandler actionHandler = GetComponent <ActionHandler>(); if (actionHandler == null) { actionHandler = gameObject.AddComponent <ActionHandler>(); } JsonUtility.FromJsonOverwrite(componentJSON, actionHandler); break; default: PrintDebug(this, 1, "Battle Component of Unrecognized type in JSON: " + componentType); BattleComponent comp = gameObject.AddComponent <BattleComponent>(); JsonUtility.FromJsonOverwrite(componentJSON, comp); break; } }
public void FromJson(string JSONObject) { JsonUtility.FromJsonOverwrite(JSONObject, this); foreach (string compJSON in componentsAsJson) { BattleComponent comp = JsonUtility.FromJson <BattleComponent>(compJSON); AddComponent(comp.BattleComponentType, compJSON); } }
/// <summary> /// Creates a new <see cref="MonsterEntity"/> instance. /// </summary> /// <param name="context"></param> public MonsterEntity() { Moves = new MovableComponent(); Timers = new TimerComponent(); Follow = new FollowComponent(); Interaction = new InteractionComponent(); Battle = new BattleComponent(); Attributes = new AttributeComponent(); }
public void paste(BattleComponent c) { setStats(c.ATK,c.DEF,c.S_DEF,c.S_ATK,c.maxHP); this.currentHP = c.currentHP; this.weapons = c.weapons; this.name = c.name; this.attacked = c.attacked; this.dead = c.dead; }
public ShotsBattleSystem(Entity player) : base(new Matcher().one(typeof(ShotComponent), typeof(MissileComponent))) { _playerSprite = player.getComponent <AnimatedSprite>(); _playerBattler = player.getComponent <BattleComponent>(); _playerCollider = player.getComponent <BoxCollider>(); _bullectEffectTexture = player.scene.content.Load <Texture2D>(Content.Effects.bulletEffect); _explosion2EffectTexture = player.scene.content.Load <Texture2D>(Content.Effects.explosionEffect2); }
/// <summary> /// Creates a new <see cref="NpcEntity"/> instance. /// </summary> /// <param name="context"></param> public NpcEntity() { Object.Type = WorldObjectType.Mover; Timers = new TimerComponent(); Interaction = new InteractionComponent(); Battle = new BattleComponent(); Attributes = new AttributeComponent(); Moves = new MovableComponent(); Follow = new FollowComponent(); }
private void setUnknownState() { _l.Info("Back to Unknown state"); _state = state.Unknown; DestroyEntity(_entity.Id); _battle = null; _entity = null; }
public override void onAddedToEntity() { _platformerObject = entity.getComponent <PlatformerObject>(); _battleComponent = entity.getComponent <BattleComponent>(); _battleComponent.setHp(40); _battleComponent.battleEntity = this; sprite = entity.getComponent <AnimatedSprite>(); }
public override void onAddedToEntity() { _platformerObject = entity.getComponent <PlatformerObject>(); battleComponent = entity.getComponent <BattleComponent>(); battleComponent.setHp(MAX_HP); battleComponent.battleEntity = this; battleComponent.ImmunityDuration = 0.5f; battleComponent.destroyEntityAction = destroyEntity; entity.setTag(SceneMap.PLAYER); }
/// <summary> /// Creates a new <see cref="PlayerEntity"/> instance. /// </summary> /// <param name="context"></param> public PlayerEntity(IPlayerFactory playerFactory) { Moves = new MovableComponent(); PlayerData = new PlayerDataComponent(); Taskbar = new TaskbarComponent(); Follow = new FollowComponent(); Interaction = new InteractionComponent(); Battle = new BattleComponent(); Timers = new TimerComponent(); Attributes = new AttributeComponent(); QuestDiary = new QuestDiaryComponent(); SkillTree = new SkillTreeComponent(); Inventory = new InventoryContainerComponent(); _playerFactory = playerFactory; }
public override void onAddedToEntity() { _spriteTail = entity.getComponent <TimedSpriteTail>(); _platformerObject = entity.getComponent <PlatformerObject>(); _platformerObject.setGetDeltaTimeFunc(GetDeltaTimeFunc); _battleComponent = entity.getComponent <BattleComponent>(); _battleComponent.battleEntity = this; _battleComponent.ImmunityDuration = 0.5f; _battleComponent.destroyEntityAction = destroyEntity; _timer = entity.scene.findEntity("timer").getComponent <TimerComponent>(); _distortionCursorSprite = entity.scene.findEntity("distortionCursor").getComponent <Sprite>(); }
public override void onAddedToEntity() { _platformerObject = entity.getComponent <PlatformerObject>(); _platformerObject.setGetDeltaTimeFunc(GetDeltaTimeFunc); _battleComponent = entity.getComponent <BattleComponent>(); _battleComponent.battleEntity = this; _battleComponent.ImmunityDuration = 0.5f; _battleComponent.destroyEntityAction = destroyEntity; _battleComponent.setMaxHp(20, true); _weaponSelectionComponent = entity.addComponent <WeaponSelectionComponent>(); _dashTrailComponent = entity.addComponent <DashTrailComponent>(); _dashTrailComponent.renderLayer = SceneMap.MISC_RENDER_LAYER; _dashTrailComponent.SetSpawnEnabled(false); }
protected override void Run(Session session, G2B_CreateBattle message, Action <B2G_CreateBattle> reply) { B2G_CreateBattle response = new B2G_CreateBattle(); try { BattleComponent battleComponent = Game.Scene.GetComponent <BattleComponent>(); Battle battle = ComponentFactory.CreateWithId <Battle, G2B_CreateBattle>(message.RoomId, message); battleComponent.Add(battle); reply(response); } catch (Exception e) { Log.Error(e); ReplyError(response, e, reply); } }
public void execute(BattleComponent origin, BattleComponent target){ Debug.Log (origin.name +" attacked "+target.name+" with "+this.name); target.takeDamage (40); //Debug.Log ("Attacked" target.+ with "+name); }
public override void begin() { _playerBattler = entity.playerCollider.entity.getComponent <BattleComponent>(); entity.sprite.play("laserAttack"); AudioManager.laser.Play(0.9f); }
public override void begin() { createLaserSprite(); _playerBattler = entity.playerCollider.entity.getComponent <BattleComponent>(); entity.sprite.play("bigLaserAttack"); }
public void attackOpponent(BattleComponent opponent){ opponent.takeDamage(damage); }
public ProjectilesSystem(Entity player) : base(new Matcher().one(typeof(ProjectileComponent))) { _playerBattler = player.getComponent <BattleComponent>(); _playerCollider = player.getComponent <BoxCollider>(); }