public override void Init(LivingEntityController enemy) { base.Init(enemy); baseMoveDelay = 1.5f; moveDelay = baseMoveDelay; //battlefield = BattlefieldManager.instance; }
public override void Init(LivingEntityController controller) { base.Init(controller); mover = controller as EnemyController; gameController = GameController.instance; navi = gameController.navi; }
// Movement + Pathing public static void MoveEntity(LivingEntity entity, Tile destination) { // This method handles all logic and events related to moving an entity from its // current location to a new one // Set up bool hasCompletedMovement = false; // Generate path from entity's current position to the destination Stack <Node> path = AStar.GetPath(entity.Position.GridPosition, destination.GridPosition); while (hasCompletedMovement == false) { // Get next tile on the path Tile nextLocationOnPath = path.Pop().TileRef; // remove entity from its current location LivingEntityController.RemoveEntityFromLocation(entity, entity.Position); // place entity at next location LivingEntityController.PlaceEntityAtLocation(entity, nextLocationOnPath); // Resolve events related to moving onto a new location // for example, moved onto a tile with an item, pick up the item OnNewLocationMovedTo(entity, nextLocationOnPath); // if we have reached the final tile in the path, resolve the movement event. if (entity.Position == destination) { hasCompletedMovement = true; } } }
public override void Execute() { // check if there is anything above this panel Ray above = new Ray(panel.transform.position, panel.transform.up); RaycastHit[] hits = Physics.RaycastAll(above, 5); LivingEntityController livingThing = null; bool foundLivingThing = false; for (int i = 0; i < hits.Length; i++) { livingThing = hits[i].transform.GetComponent <LivingEntityController>(); if (livingThing != null) { wasSteppedOn = true; foundLivingThing = true; break; } } if (wasSteppedOn && !foundLivingThing) { // apparently something stepped off of this panel, so it's time to break it PanelInfo brokenPanel = PanelDatabase.instance.GetPanel("Broken Panel"); panel.ChangeTo(brokenPanel); } }
public override void Init(LivingEntityController controller) { base.Init(controller); baseMoveDelay = 1f; moveDelay = baseMoveDelay; poisedToSlash = new UnityEvent(); }
protected override void Awake() { base.Awake(); TriggerCollider = GetComponent <CircleCollider2D>(); AudioSource = GetComponent <AudioSource>(); LivingEntityController = GetComponent <LivingEntityController>(); }
public virtual void Init(LivingEntityController controller) { battlefield = BattlefieldManager.instance; baseMoveDelay = 0.25f; moveDelay = baseMoveDelay; canMove = false; this.mover = controller; }
// Handle Events #region public static void HandleDamage(LivingEntity target, int damageValue) { LivingEntityController.ModifyEntityCurrentHealth(target, -damageValue); if (target.CurrentHealth <= 0) { HandleDeath(target); } }
protected override void OnTriggerEnter(Collider other) { base.OnTriggerEnter(other); LivingEntityController livingEntity = other.gameObject.GetComponent <LivingEntityController>(); // only hurt the target if it wasn't hurt already by this attack in this frame if (livingEntity.onSideOf != this.onSideOf && !entitiesDamaged.Contains(livingEntity)) { livingEntity.TakeDamage(damage, damageType); entitiesDamaged.Add(livingEntity); } }
public virtual void Init(LivingEntityController spawner) { this.onSideOf = spawner.onSideOf; if (onSideOf == Combatant.enemy) { // make the attack face the player's side of the field Vector3 reversedScale = transform.localScale; reversedScale.x = -reversedScale.x; transform.localScale = reversedScale; } panelCurrentlyOn = GetPanelCurrentlyOn(); }
public void OnCollisionEnter2D(Collision2D collision) { LivingEntityController entity = collision.gameObject.GetComponent <LivingEntityController>(); if (entity != null) { if (entity.IsAlive()) { entity.Injure(Damage, Shooter); } } OnDestroy(); }
void Awake() { Name = transform.GetComponentInChildren <Text>(); Name.text = gameObject.name; Group = transform.GetComponentInChildren <CanvasGroup>(); Group.SetVisible(false, false); LivingEntityController = GetComponent <LivingEntityController>(); LivingEntityController.LocalMessenger.On(LivingEntityController.MESSAGE_DEATH, OnDeath); Light = GetComponentInChildren <Light>(); }
public override void Init(LivingEntityController controller) { /* * Setting up details that will drive how the movement works. */ base.Init(controller); baseMoveDelay = 2f; moveDelay = 0.1f; // let the hammer attack immediately basePosition = mover.panelCurrentlyOn.transform.position; basePosition.y = mover.transform.position.y; ReadyToSlash = new UnityEvent(); }
public static void HandleDeath(LivingEntity entityKilled) { // Future implementation: Create and resolve on death events, for example. // Explode on death, damaging nearby characters // If entity killed is enemy, increase player score // etc // Remove from controller list LivingEntityController.RemoveEntityFromAllEntitiesList(entityKilled); // Remove from activation order TurnController.activationOrder.Remove(entityKilled); // Make entities tile available LivingEntityController.RemoveEntityFromLocation(entityKilled, entityKilled.Position); }
public void Init(LivingEntityController controller) { this.controller = controller; gameController = GameController.instance; }