public EnvironmentBridge(WalkNode p, WalkNode a = null, WalkNode b = null) { pivot = p; destinationA = a; destinationB = b; isPointingA = true; }
private void ConstructBehaviourTree() { DieNode dieNode = new DieNode(this, animator); AttackNode attackNode = new AttackNode(animator); IsCloserNode isCloseToAttack = new IsCloserNode(this.transform, Player.instance.transform, agent.stoppingDistance); ChaseNode chaseNode = new ChaseNode(Player.instance.transform, agent, animator); WalkNode walkNode = new WalkNode(agent, animator, changeDestinationDelay, walkRadius); WasHittedNode wasHittedNode = new WasHittedNode(this); IsPlayerVisibleNode isPlayerVisibleNode = new IsPlayerVisibleNode(transform, zombieSettings.ZombieAgroRadius, zombieSettings.FieldsOfViewAngle, playerLayer); Sequence attackSequence = new Sequence(new List <Node>() { isCloseToAttack, attackNode }); Sequence chaseSequence = new Sequence(new List <Node>() { isPlayerVisibleNode, chaseNode }); Sequence hittedSequence = new Sequence(new List <Node>() { wasHittedNode, chaseNode }); topNode = new Selector(new List <Node>() { dieNode, attackSequence, hittedSequence, chaseSequence, walkNode }); }
public override void InitMinion(WalkNode n, Vector3 pos = default(Vector3)) { hasBeenFreed = true; transform.position = new Vector3(pos.x, airYpos, pos.z); //the zeppelin will give the next node. pNextNode = n; }
/// <summary> /// Will release and set minion walk to true. One minion at a time; /// </summary> public bool SetNextMinionFree(WalkNode node, Vector3 position = default(Vector3)) { foreach (var minion in _minions) { if (minion != null && !minion.hasBeenFreed && !minion.IsDead) { minion.InitMinion(node, position); minion.SetWalk(true); return(true); } } return(false); //there is not a minion deactivated }
public virtual void InitMinion(WalkNode n, Vector3 pTransform = default(Vector3)) { hasBeenFreed = true; if (pTransform == default(Vector3)) { transform.position = n.transform.position; } else { transform.position = pTransform; } pNextNode = n.GetNextWalkNode(); }
public bool Initialize(float lastingTime, float cooldown, int times, GameObject prefab, WalkNode nextNode) { var result = base.Initialize(lastingTime, cooldown); if (!result) { return(false); } _miniZepCount = times; _prefab = prefab; _nextNode = nextNode; return(true); }
protected virtual void Walk() { var dir = (pNextNode.transform.position - transform.position).normalized; transform.forward = dir; transform.position += transform.forward * speed * Time.deltaTime; if (Vector3.Distance(transform.position, pNextNode.transform.position) <= pDistanceToNextNode) { if (!pNextNode.isEnd) { pNextNode = pNextNode.GetNextWalkNode(); } else { FinishWalk(); } } }
List <WalkNode> GetNodeList(WalkNode node, List <WalkNode> list) { if (node) { list.Add(node); } if (node.isEnd) { return(list); } foreach (var item in node.nexts) { list.AddRange(GetNodeList(item, new List <WalkNode>())); } return(list); }
/// <summary> /// For bridge event. /// </summary> public bool MinionHasToFall(GroundMinion m, WalkNode nextWalkNode) { if (nextWalkNode.levelEventBridgeNodeName == "" || nextWalkNode.levelEventBridgeNodeName.Contains("pivot")) { return(false); } foreach (var bridge in _levelBridges) { if (nextWalkNode.levelEventBridgeNodeName == bridge.destinationA.levelEventBridgeNodeName) { var isInsideBridge = bridge.bridge_B_GameObject.IsMinionInsideBridge(m); return(isInsideBridge && !bridge.isPointingA); } else if (nextWalkNode.levelEventBridgeNodeName == bridge.destinationB.levelEventBridgeNodeName) { var isInsideBridge = bridge.bridge_A_GameObject.IsMinionInsideBridge(m); return(isInsideBridge && bridge.isPointingA); } } return(false); }
public override void InitMinion(WalkNode n, Vector3 pTransform = default(Vector3)) { base.InitMinion(n, pTransform); InitSkillAreaEffect(skillArea); }
public override void InitMinion(WalkNode n, Vector3 pos = default(Vector3)) { hasBeenFreed = true; transform.position = new Vector3(n.transform.position.x, airYpos, n.transform.position.z); pNextNode = n.GetNextWalkNode(); }
/// <summary> /// This func has to be executable within level initialization /// isIn = is for when spawning a new minion? true /// </summary> public void Init(WalkNode targetNode) { _targetNode = targetNode; }