// Because we dont know what orders the Start()s are called in. public void Initialize(PuppetScript _sender) { Owner = _sender; GrdTmrMax = _sender.GrdTmrMax; GrdTmrCur = 0.0f; }
// Guard Upwards function // returns -1 on failure // returns 1 on success public int GuardUpwards(PuppetScript _sender) { GrdTmrCur = GrdTmrMax; lastGrdDir = PuppetScript.State.GRD_TOP; animation.CrossFade("Block Up", 0.1f); return 1; }
// Use this for initialization void Start () { puppet = gameObject.GetComponent<PuppetScript>(); behaviourTree = gameObject.GetComponent<BehaviourTree>(); switch (trainerType) { case TRAINER_TYPE.ATTACK_TOP: behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.SLASH_TOP)); break; case TRAINER_TYPE.ATTACK_LEFT: behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.SLASH_LEFT)); break; case TRAINER_TYPE.ATTACK_RIGHT: behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.SLASH_RIGHT)); break; case TRAINER_TYPE.GUARD_LEFT: behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.GUARD_LEFT, 1.5f)); break; case TRAINER_TYPE.GUARD_RIGHT: behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.GUARD_RIGHT, 1.5f)); break; case TRAINER_TYPE.GUARD_TOP: behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.GUARD_TOP, 1.5f)); break; case TRAINER_TYPE.IDLE: break; } behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.WINDOW_OF_OPPORTUNITY, 1.5f)); }
// Guard Right function // returns -1 on failure // returns 1 on success public int GuardRight(PuppetScript _sender) { GrdTmrCur = GrdTmrMax; lastGrdDir = PuppetScript.State.GRD_RIGHT; animation.CrossFade("Block Right", 0.1f); return 1; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PuppetScript>(); theGUI = GameObject.Find("GUI").GetComponent<Canvas>(); tutorial = GameObject.Find("Tutorial").GetComponent<Canvas>(); if (theGUI) { guardLeft = GameObject.Find("GUI/Panel/Guard HUD/Guard Left").GetComponent<Image>(); guardRight = GameObject.Find("GUI/Panel/Guard HUD/Guard Right").GetComponent<Image>(); guardTop = GameObject.Find("GUI/Panel/Guard HUD/Guard Top").GetComponent<Image>(); tally1 = GameObject.Find("GUI/Panel/Tally1").GetComponent<Image>(); tally2 = GameObject.Find("GUI/Panel/Tally2").GetComponent<Image>(); tally3 = GameObject.Find("GUI/Panel/Tally3").GetComponent<Image>(); } dances.Add("Twerk"); dances.Add("Gangnam Style"); dances.Add("Robot"); dances.Add("Thriller 1"); dances.Add("Thriller 2"); dances.Add("Thriller 3"); dances.Add("Thriller 4"); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); agent = GetComponent <NavMeshAgent>(); puppet = GetComponent <PuppetScript>(); protectiveAction = ScriptableObject.CreateInstance <ReactiveGuard>(); protectiveAction.animation = animation; protectiveAction.puppet = puppet; protectiveAction.GuardTimerMax = guardTimer; protectiveAction.playerPuppet = player.GetComponent <PuppetScript>(); protectiveAction.dances = new List <string>(); protectiveAction.dances.Add("Twerk"); protectiveAction.dances.Add("Gangnam Style"); protectiveAction.dances.Add("Robot"); PopulateActions(phaseOneAttacks, ref phaseOne); if (!repeatActions) { PopulateActions(phaseTwoAttacks, ref phaseTwo); } else { PopulateActions(phaseOneAttacks, ref phaseTwo); } currentAction = phaseOne[0]; }
// Because we dont know what orders the Start()s are called in. public void Initialize(PuppetScript _sender) { Owner = _sender; //Animetor = _sender.Animetor; //AtkTmrMax = _sender.AtkTmrMax; //AtkTmrCur = 0.0f; }
// Use this for initialization void Start() { curStam = maxStam = 5.0f; puppet = gameObject.GetComponent<PuppetScript>(); lastAttack = ATTACKS.NONE; if (guard) stance = guard.GetComponent<MyStance>(); }
void PhaseOne(float angleToPlayer) { if (angleToPlayer > 5.0f || (gameObject.transform.position - player.transform.position).magnitude > StoppingDistance) { inRange = false; } else { inRange = true; resetTimer = 0.0f; agent.Stop(); } if (inRange || currentAction.isBehaving()) { if (currentAction.Execute() == COMPLETION_STATE.COMPLETE) { // Increment the action nextAction++; if (nextAction >= phaseOne.Count) { nextAction = 0; } currentAction = phaseOne[nextAction]; } } else { resetTimer += Time.deltaTime; if (resetTimer > resetTimerMax) { resetTimer = 0.0f; currentAction = phaseOne[0]; nextAction = 0; } SeekPlayer(); } if (puppet.curTallys <= 2) { if (minion != null) { GameObject thisGuy = (GameObject)(GameObject.Instantiate(minion, minionSpawnLocation.transform.position, Quaternion.identity)); minionPuppet = thisGuy.GetComponent <PuppetScript>(); minionSummoned = true; agent.SetDestination(retreatPoint.transform.position); puppet.ChangeState(PuppetScript.State.MOVING); animation.Play("Walk Forward"); } phase = PHASE.TWO; } }
void Start() { currentBehaviour = 0; puppet = gameObject.GetComponent <PuppetScript>(); player = GameObject.FindGameObjectWithTag("Player"); agent = gameObject.GetComponent <NavMeshAgent>(); FuckYouUnity(); behaviourTimer = 0.0f; //agent.updatePosition = false; //agent.updateRotation = false; }
void Start() { currentBehaviour = 0; puppet = gameObject.GetComponent<PuppetScript>(); player = GameObject.FindGameObjectWithTag("Player"); agent = gameObject.GetComponent<NavMeshAgent>(); FuckYouUnity(); behaviourTimer = 0.0f; //agent.updatePosition = false; //agent.updateRotation = false; }
//void UpdateTmrs(ref float _cur) //{ // if (_cur > 0.0f) // { // _cur -= Time.deltaTime; // if (_cur <= 0.0f) // { // _cur = 0.0f; // Owner.ChangeState(PuppetScript.State.IDLE); // } // } //} // Vertical Slash function // returns -1 on failure // returns 1 on success public int SlashVert(PuppetScript _sender) { //Trigger animation animation["Down Slash"].speed = attackSpeed; animation.CrossFade("Down Slash", 0.1f); //AtkTmrCur = animation["Down Slash"].length / animation["Down Slash"].speed; // move us closer to the enemy please! Owner.rigidbody.AddForce(Owner.transform.forward * 50000.0f); return 1; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PuppetScript>(); left = GameObject.Find("GUI/Panel/Blood/Left").GetComponent<Image>(); right = GameObject.Find("GUI/Panel/Blood/Right").GetComponent<Image>(); top = GameObject.Find("GUI/Panel/Blood/Top").GetComponent<Image>(); bottom = GameObject.Find("GUI/Panel/Blood/Bottom").GetComponent<Image>(); if (player) { lastBalance = player.curTallys; } fadeTimer = maxFadeTime; }
// Use this for initialization void Start () { enemyState = ENEMY_STATE.PATROL; puppet = GetComponent<PuppetScript>(); player = GameObject.FindGameObjectWithTag("Player"); noticeArea = gameObject.GetComponent<SphereCollider>(); behaviourTree = gameObject.GetComponent<BehaviourTree>(); behaviourTree.FuckYouUnity(); foreach (GameObject patrolPoint in patrolPoints) { behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.PATROL, patrolPoint.transform.position, 0.0f)); } if(patrolPoints.Length == 0) { behaviourTree.AddBehaviour(new AIBehaviour(AI_STATE.PATROL, gameObject.transform.position, 0.0f)); } }
// Because we dont know what orders the Start()s are called in. public void Initialize(PuppetScript _sender) { Owner = _sender; camSpeed = _sender.camSpeed; def_camSpeed = camSpeed; followCam = GameObject.FindGameObjectWithTag("MainCamera"); camTarg = GameObject.FindGameObjectWithTag("CamTarg"); camRot = followCam.transform.rotation; if (camOffsetPos == Vector3.zero) { camOffsetPos.x = 0.0f; camOffsetPos.y = 1.0f; camOffsetPos.z = -4.0f; } def_OffsetPos = camOffsetPos; if (targOffsetPos == Vector3.zero) { targOffsetPos.x = 0.0f; targOffsetPos.y = 1.5f; targOffsetPos.z = 0.0f; } if (rockedOffsetPos == Vector3.zero) { rockedOffsetPos.x = 1.5f; rockedOffsetPos.y = 0.0f; rockedOffsetPos.z = 0.0f; } def_rockedOffsetPos = rockedOffsetPos; camOffsetRatio = 1.0f; last_camOffsetRatio = camOffsetRatio; if (rockedMinMax == 0.0f) { rockedMinMax = 2.0f; } }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); agent = GetComponent<NavMeshAgent>(); puppet = GetComponent<PuppetScript>(); protectiveAction = ScriptableObject.CreateInstance<ReactiveGuard>(); protectiveAction.animation = animation; protectiveAction.puppet = puppet; protectiveAction.GuardTimerMax = guardTimer; protectiveAction.playerPuppet = player.GetComponent<PuppetScript>(); protectiveAction.dances = new List<string>(); protectiveAction.dances.Add("Twerk"); protectiveAction.dances.Add("Gangnam Style"); protectiveAction.dances.Add("Robot"); PopulateActions(phaseOneAttacks, ref phaseOne); if (!repeatActions) PopulateActions(phaseTwoAttacks, ref phaseTwo); else PopulateActions(phaseOneAttacks, ref phaseTwo); currentAction = phaseOne[0]; }
// Use this for initialization void Start () { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PuppetScript>(); }
void PhaseOne(float angleToPlayer) { if (angleToPlayer > 5.0f || (gameObject.transform.position - player.transform.position).magnitude > StoppingDistance) { inRange = false; } else { inRange = true; resetTimer = 0.0f; agent.Stop(); } if (inRange || currentAction.isBehaving()) { if (currentAction.Execute() == COMPLETION_STATE.COMPLETE) { // Increment the action nextAction++; if (nextAction >= phaseOne.Count) nextAction = 0; currentAction = phaseOne[nextAction]; } } else { resetTimer += Time.deltaTime; if (resetTimer > resetTimerMax) { resetTimer = 0.0f; currentAction = phaseOne[0]; nextAction = 0; } SeekPlayer(); } if (puppet.curTallys <= 2) { if (minion != null) { GameObject thisGuy = (GameObject)(GameObject.Instantiate(minion, minionSpawnLocation.transform.position, Quaternion.identity)); minionPuppet = thisGuy.GetComponent<PuppetScript>(); minionSummoned = true; agent.SetDestination(retreatPoint.transform.position); puppet.ChangeState(PuppetScript.State.MOVING); animation.Play("Walk Forward"); } phase = PHASE.TWO; } }
// Use this for initialization void Start() { if (windowTell == null) { Debug.LogWarning("I NEED A WINDOW OF OPPORTUNITY EFFECT IN Window Tell PLS KTHX"); } player = GameObject.FindGameObjectWithTag("Player"); agent = GetComponent<NavMeshAgent>(); puppet = GetComponent<PuppetScript>(); FindMonitor(); nextAction = 1; actions = new List<Action>(); foreach (ATTACK_TYPE attack in attacks) { switch (attack) { case ATTACK_TYPE.LEFT: { SlashLeft move = ScriptableObject.CreateInstance<SlashLeft>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.RIGHT: { SlashRight move = ScriptableObject.CreateInstance<SlashRight>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.TOP: { SlashTop move = ScriptableObject.CreateInstance<SlashTop>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.THRUST: { ThrustForward move = ScriptableObject.CreateInstance<ThrustForward>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.GUARD_LEFT: { GuardLeft move = ScriptableObject.CreateInstance<GuardLeft>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.GUARD_RIGHT: { GuardRight move = ScriptableObject.CreateInstance<GuardRight>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.GUARD_TOP: { GuardTop move = ScriptableObject.CreateInstance<GuardTop>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.REACTIVE_GUARD: { ReactiveGuard move = ScriptableObject.CreateInstance<ReactiveGuard>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.playerPuppet = player.GetComponent<PuppetScript>(); move.dances = new List<string>(); move.dances.Add("Twerk"); move.dances.Add("Gangnam Style"); move.dances.Add("Robot"); move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.WINDOW_SHORT: { WindowOfOpportunity move = ScriptableObject.CreateInstance<WindowOfOpportunity>(); move.WindowTell = windowTell; move.animation = animation; move.puppet = puppet; move.TimerMax = shortTimer; move.type = Action.TYPE.WINDOW; actions.Add(move); } break; case ATTACK_TYPE.WINDOW_MEDIUM: { WindowOfOpportunity move = ScriptableObject.CreateInstance<WindowOfOpportunity>(); move.WindowTell = windowTell; move.animation = animation; move.puppet = puppet; move.TimerMax = mediumTimer; move.type = Action.TYPE.WINDOW; actions.Add(move); } break; case ATTACK_TYPE.WINDOW_LONG: { WindowOfOpportunity move = ScriptableObject.CreateInstance<WindowOfOpportunity>(); move.WindowTell = windowTell; move.animation = animation; move.puppet = puppet; move.TimerMax = longTimer; move.type = Action.TYPE.WINDOW; actions.Add(move); } break; } } agent.stoppingDistance = 0.0f; currentAction = actions[0]; }
// Use this for initialization void Start() { if (windowTell == null) { Debug.LogWarning("I NEED A WINDOW OF OPPORTUNITY EFFECT IN Window Tell PLS KTHX"); } player = GameObject.FindGameObjectWithTag("Player"); agent = GetComponent <NavMeshAgent>(); puppet = GetComponent <PuppetScript>(); FindMonitor(); nextAction = 1; actions = new List <Action>(); foreach (ATTACK_TYPE attack in attacks) { switch (attack) { case ATTACK_TYPE.LEFT: { SlashLeft move = ScriptableObject.CreateInstance <SlashLeft>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.RIGHT: { SlashRight move = ScriptableObject.CreateInstance <SlashRight>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.TOP: { SlashTop move = ScriptableObject.CreateInstance <SlashTop>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.THRUST: { ThrustForward move = ScriptableObject.CreateInstance <ThrustForward>(); move.animation = animation; move.puppet = puppet; move.type = Action.TYPE.SLASH; actions.Add(move); break; } case ATTACK_TYPE.GUARD_LEFT: { GuardLeft move = ScriptableObject.CreateInstance <GuardLeft>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.GUARD_RIGHT: { GuardRight move = ScriptableObject.CreateInstance <GuardRight>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.GUARD_TOP: { GuardTop move = ScriptableObject.CreateInstance <GuardTop>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.REACTIVE_GUARD: { ReactiveGuard move = ScriptableObject.CreateInstance <ReactiveGuard>(); move.animation = animation; move.puppet = puppet; move.GuardTimerMax = guardTimer; move.playerPuppet = player.GetComponent <PuppetScript>(); move.dances = new List <string>(); move.dances.Add("Twerk"); move.dances.Add("Gangnam Style"); move.dances.Add("Robot"); move.type = Action.TYPE.GUARD; actions.Add(move); } break; case ATTACK_TYPE.WINDOW_SHORT: { WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>(); move.WindowTell = windowTell; move.animation = animation; move.puppet = puppet; move.TimerMax = shortTimer; move.type = Action.TYPE.WINDOW; actions.Add(move); } break; case ATTACK_TYPE.WINDOW_MEDIUM: { WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>(); move.WindowTell = windowTell; move.animation = animation; move.puppet = puppet; move.TimerMax = mediumTimer; move.type = Action.TYPE.WINDOW; actions.Add(move); } break; case ATTACK_TYPE.WINDOW_LONG: { WindowOfOpportunity move = ScriptableObject.CreateInstance <WindowOfOpportunity>(); move.WindowTell = windowTell; move.animation = animation; move.puppet = puppet; move.TimerMax = longTimer; move.type = Action.TYPE.WINDOW; actions.Add(move); } break; } } agent.stoppingDistance = 0.0f; currentAction = actions[0]; }
// Dodge Backwards function // returns -1 on failure // returns 1 on success public int DodgeBackwards(PuppetScript _sender) { animation.Play("Dodge Backward"); DgeTmrCur = DgeTmrMax; orgRot = transform.rotation; return 1; }
public void Initialize(PuppetScript _owner) { if (_owner != null) Owner = _owner; }
// Thrust function // returns -1 on failure // returns 1 on success public int Thrust(PuppetScript _sender) { if (_sender.gameObject.tag == "Player") { //if (_sender.currZen - 2.5f < 0.0f) // return -1; Owner.currZen -= 2.5f; } animation["Stab"].speed = attackSpeed; animation.CrossFade("Stab", 0.1f); //AtkTmrCur = animation["Stab"].length / animation["Left Slash"].speed; // move us closer to the enemy please! Owner.rigidbody.AddForce(Owner.transform.forward * 100000.0f); //Owner.currZen -= 2.5f; return 1; }
// Kick function // returns -1 on failure // returns 1 on success public int Kick(PuppetScript _sender) { animation.CrossFade("Down Slash", 0.1f); //AtkTmrCur = Animetor.animation.clip.length; return 1; }
// Update is called once per frame void Update() { // this will check the status of all enemies if (singleSpawn == false && enemiesInScene != null) { for (int i = 0; i < enemiesInScene.Count; ++i) { PuppetScript p = enemiesInScene[i].GetComponent <PuppetScript>(); if (p && p.curTallys <= 0.0f) { Destroy(enemiesInScene[i], enemiesInScene[i].GetComponent <Animation>()["Death"].length + 0.5f); toRemove.Add(i); // queue for removal killCount++; if (killCount >= killsRequired) { if (doorFriends) { doorFriends.MoveTheDoorsPls(false); } } } } // if things need to go, update list if (toRemove.Count > 0) { int remainingEnemies = enemiesInScene.Count - toRemove.Count; if (remainingEnemies <= 0) // all are dead { enemiesInScene.Clear(); enemiesInScene = null; return; // stop now } foreach (int kill in toRemove) { enemiesInScene.RemoveAt(kill); } toRemove.Clear(); } } // this governs single file spawner else if (singleSpawn && currEnemy) { PuppetScript p = currEnemy.GetComponent <PuppetScript>(); if (p && p.curTallys <= 0.0f) { //p.ChangeState(PuppetScript.State.DEAD); //GameObject.FindGameObjectWithTag("Player").GetComponent<PuppetScript>().RemoveEnemy(currEnemy); Destroy(currEnemy, currEnemy.GetComponent <Animation>()["Death"].length + 0.5f); currEnemy = null; killCount++; if (killCount >= killsRequired) { if (doorFriends) { doorFriends.MoveTheDoorsPls(false); } } index++; if (index >= enemies.Length) { index = 0; } waiting = true; } } if (waiting) { timer += Time.deltaTime; if (timer >= waitTime) { timer = 0.0f; waiting = false; currEnemy = (GameObject)Instantiate(enemies[index], spawnPoint.transform.position, Quaternion.identity); } } }