protected int Register(AIFormation follower) { var old = _followerBuild.IndexOf(follower); if (old >= 0) { return(old); } var id = _followerBuild.Count; _followerBuild.Add(follower); return(id); }
private void Awake() { _actor = GetComponent <Actor>(); _formation = GetComponent <AIFormation>(); _brain = GetComponent <FighterBrain>(); }
private void switchTo(int index) { if (Characters == null || Characters.Length <= index) { return; } for (int i = 0; i < Characters.Length; i++) { var isAI = i != index; if (!isAI && Characters[i] != null) { var actions = Characters[i].GetComponent <AIActions>(); if (actions != null && actions.IsPerforming) { isAI = true; } } setCharacter(i, !isAI, isAI); } _active = index; var active = GetActive(); if (active != null) { if (HUD != null) { HUD.Player = active; } var comp = active.GetComponent <AIFormation>(); if (comp != null && _previousFormation != null) { comp.Formation = _previousFormation.Formation; } _previousFormation = comp; } var topDownCamera = GetComponent <TopDownCamera>(); var strategyCamera = GetComponent <StrategyCamera>(); var thirdPersonCamera = GetComponent <ThirdPersonCamera>(); var mobileCamera = GetComponent <MobileCamera>(); var motor = Characters[index].GetComponent <CharacterMotor>(); if (topDownCamera != null) { topDownCamera.Target = motor; } if (strategyCamera != null) { strategyCamera.Target = motor; } if (thirdPersonCamera != null) { thirdPersonCamera.Target = motor; } if (mobileCamera != null) { mobileCamera.Target = motor; } }