protected virtual void RemoveFromAIObjectives() { foreach (var player in GlobalVariables.Instance.AlivePlayersList) { if (player == gameObject) { continue; } AIGameplay aiScript = player.GetComponent <AIGameplay>(); if (aiScript == null) { continue; } if (aiScript.objectives.Contains(gameObject)) { aiScript.objectives.Remove(gameObject); } if (aiScript.shootTarget == transform) { aiScript.shootTarget = null; } } }
public void PlayersControllers() { int mouseKeyboard = 0; int gamepads = 0; if (GlobalVariables.Instance.PlayersControllerNumber[0] == 0 || GlobalVariables.Instance.PlayersControllerNumber[1] == 0 || GlobalVariables.Instance.PlayersControllerNumber[2] == 0 || GlobalVariables.Instance.PlayersControllerNumber[3] == 0) { mouseKeyboard = 1; } if (GlobalVariables.Instance.PlayersControllerNumber[0] > 0) { gamepads += 1; } if (GlobalVariables.Instance.PlayersControllerNumber[1] > 0) { gamepads += 1; } if (GlobalVariables.Instance.PlayersControllerNumber[2] > 0) { gamepads += 1; } if (GlobalVariables.Instance.PlayersControllerNumber[3] > 0) { gamepads += 1; } GameAnalytics.NewDesignEvent("Game:" + GlobalVariables.Instance.CurrentModeLoaded.ToString() + ":GamepadsCount", gamepads); GameAnalytics.NewDesignEvent("Game:" + GlobalVariables.Instance.CurrentModeLoaded.ToString() + ":Mouse", mouseKeyboard); GameAnalytics.NewDesignEvent("Game:" + GlobalVariables.Instance.CurrentModeLoaded.ToString() + ":PlayersCount", GlobalVariables.Instance.NumberOfPlayers); GameAnalytics.NewDesignEvent("Game:" + GlobalVariables.Instance.CurrentModeLoaded.ToString() + ":BotsCount", GlobalVariables.Instance.NumberOfBots); if (GlobalVariables.Instance.NumberOfBots > 0) { foreach (var p in GlobalVariables.Instance.AlivePlayersList) { if (p == null) { continue; } AIGameplay script = p.GetComponent <AIGameplay> (); if (script == null) { continue; } GameAnalytics.NewDesignEvent("Game:" + GlobalVariables.Instance.CurrentModeLoaded.ToString() + ":BotsLevel", (int)script.aiLevel); } } }
public void AISetup() { if (aiScript == null) { playerScript = GetComponent <PlayersGameplay>(); aiScript = (AIGameplay)playerScript; } SetupPlayer(trails); playerMesh = SetupPlayer(meshes).transform; stunMesh = SetupPlayer(stunMeshes).transform; dashAvailableFX = SetupPlayer(dashDispo).GetComponent <ParticleSystem>(); dashFX = SetupPlayer(dash).GetComponent <ParticleSystem>(); playerColorMaterial = GlobalVariables.Instance.playersMaterials[(int)aiScript.playerName]; stunMesh.gameObject.SetActive(false); base.Setup(); }
// Use this for initialization protected virtual void Awake() { AIScript = GetComponent <AIGameplay>(); }
protected override void Start() { base.Start(); AIScript = transform.GetComponentInParent <AIGameplay> (); }
protected override void Start() { aiScript = (AIGameplay)playerScript; base.Start(); }
// Use this for initialization void Awake() { AIScript = transform.GetComponentInParent <AIGameplay> (); LoadModeManager.Instance.OnLevelLoaded += () => AIScript.objectives.Clear(); AIScript.OnStun += () => AIScript.objectives.Clear(); AIScript.OnDeath += () => AIScript.objectives.Clear(); if (removeHoldMovable) { AIScript.OnHold += () => { if (AIScript.objectives.Contains(AIScript.holdMovableTransform.gameObject)) { AIScript.objectives.Remove(AIScript.holdMovableTransform.gameObject); Refresh(); } } } ; } void OnTriggerStay(Collider collider) { if (collider.tag == "Player" || collider.tag == "Movable" || collider.tag == "Suggestible" || collider.tag == "DeadCube") { if (removeHoldMovable) { if (collider.tag == "Movable" && collider.gameObject.transform == AIScript.holdMovableTransform) { return; } } if (!collider.gameObject.activeSelf && AIScript.objectives.Contains(collider.gameObject)) { AIScript.objectives.Remove(collider.gameObject); } if (!collider.gameObject.activeSelf) { return; } if (!AIScript.objectives.Contains(collider.gameObject)) { AIScript.objectives.Add(collider.gameObject); } Refresh(); } } void OnTriggerExit(Collider collider) { if (collider.tag == "Player" || collider.tag == "Movable" || collider.tag == "Suggestible" || collider.tag == "DeadCube") { if (AIScript.objectives.Contains(collider.gameObject)) { AIScript.objectives.Remove(collider.gameObject); } } } void Refresh() { AIScript.isAimingShootTarget = false; AIScript.isAimingHoldTarget = false; if (GlobalVariables.Instance.GameState != GameStateEnum.Playing) { return; } if (AIScript.objectives.Count == 0) { return; } AIScript.objectives = AIScript.objectives.OrderBy(x => Vector3.Distance(transform.parent.position, x.transform.position)).ToList(); for (int i = 0; i < targetSearchCount + 1; i++) { if (i >= AIScript.objectives.Count) { break; } if (AIScript.shootTarget && AIScript.objectives[i] == AIScript.shootTarget.gameObject) { AIScript.isAimingShootTarget = true; break; } } if (AIScript.holdTarget && AIScript.objectives[0] == AIScript.holdTarget.gameObject) { AIScript.isAimingHoldTarget = true; } AIScript.aiAnimator.SetBool("isAimingShootTarget", AIScript.isAimingShootTarget); AIScript.aiAnimator.SetBool("isAimingHoldTarget", AIScript.isAimingHoldTarget); } }