public void StartTheThrow(CharacterControler thrower) { otherChar = thrower; rb.velocity = Vector3.zero; otherChar.rb.velocity = Vector3.zero; animator.SetBool("canFloat", false); otherChar.animator.SetBool("canFloat", false); StandardIssueCombatActionConnectSwitches(); otherChar.StandardIssueCombatActionConnectSwitches(); isInThrow = true; isCrouching = false; HandleGeneralCollider(); otherChar.isInThrow = true; throwBreakable = true; //float positionOffset; if (hitFromFront) { animator.Play("ThrowReactionForward"); thrower.animator.Play("CombatThrowForward"); } else { throwBreakable = false; animator.Play("ThrowReactionBack"); thrower.animator.Play("CombatThrowBack"); } throwParticles = (GameObject)Instantiate(Resources.Load("Effects/ThrowParticles/ThrowParticles"), transform); Destroy(throwParticles, 1.5f); }
public void OnTwoAnimalsWantToPlay(CharacterControler firstAnimal, CharacterControler secondAnimal) { if (Couple2Pair == 0 || FailBeforeLoose == 0) { return; } if (firstAnimal.AnimalType == secondAnimal.AnimalType && firstAnimal.Sex != secondAnimal.Sex) { SpawnKiss(Vector3.Lerp(firstAnimal.transform.position, secondAnimal.transform.position, 0.5f)); --Couple2Pair; if (Couple2Pair == 0) { Debug.Log("Win"); SceneManager.LoadScene("Game/Scenes/UI/WinLevel", LoadSceneMode.Additive); // Stop all mobs here } } else { --FailBeforeLoose; if (FailBeforeLoose == 0) { Debug.Log("Loose"); SceneManager.LoadScene("Game/Scenes/UI/LooseLevel", LoadSceneMode.Additive); // Stop all mobs here PlaySound(looseSound); StartCoroutine(RestartLevel()); } } //Destroy(firstAnimal.gameObject); //Destroy(secondAnimal.gameObject); }
// Start is called before the first frame update void Start() { _cam = Camera.main; _charactersFemale = new List <CharacterControler>(); _charactersMale = new List <CharacterControler>(); _kissEffect = Instantiate(Resources.Load <GameObject>("Prefabs/Effects/HeartParticlesInGameObject")); _kissEffect.SetActive(false); _kissEffect.transform.rotation = Quaternion.AngleAxis(45, Vector3.up); foreach (Transform t in Characters.transform) { CharacterControler characterCont = t.gameObject.GetComponent <CharacterControler>(); if (characterCont) { if (characterCont.Sex == CharacterControler.SexEnum.Female) { _charactersFemale.Add(characterCont); } else if (characterCont.Sex == CharacterControler.SexEnum.Male) { _charactersMale.Add(characterCont); } } } Debug.Log("Found " + _charactersMale.Count + " male(s) and " + _charactersFemale.Count + " famale(s)."); CalculateMaleTargets(); }
private void Start() { if (ButtonCooler == 0) { ButtonCooler = 0.3f; //if this value is not initalized in the editor it is set to a default } if (m_dashForce == 0) { m_dashForce = 1000f; } m_rigBodRef = GetComponent <Rigidbody>(); m_camObjRef = GameObject.FindWithTag("MainCamera"); particleRef = GameObject.Find("Empowered_DashEffect").GetComponent <ParticleSystem>(); /*Empowered Dash Variable Initialization*/ m_charContRef = GetComponent <CharacterControler>(); /*Debug UI init*/ m_debugCanvasRef = GameObject.FindWithTag("DebugUI"); m_debugTextField_01 = GameObject.FindWithTag("DebugUIText01"); playerLucRef = GameObject.FindWithTag("Player").GetComponent <LucidityControl>(); }
// Use this for initialization void Awake() { p1StartingPosition = p1StartingPositionTransform.position; p2StartingPosition = p2StartingPositionTransform.position; player1GameObject = Instantiate(playerPrefab, p1StartingPosition, Quaternion.identity); player2GameObject = Instantiate(playerPrefab, p2StartingPosition, Quaternion.identity); player1 = player1GameObject.GetComponent <CharacterControler>(); player2 = player2GameObject.GetComponent <CharacterControler>(); P1HealthBar.GetComponentInChildren <HealthBarScript>().character = player1; P2HealthBar.GetComponentInChildren <HealthBarScript>().character = player2; player1.SetupControl(1, MatchSettings.Instance.p1Color); player2.SetupControl(2, MatchSettings.Instance.p2Color); player1.facingLeft = false; player2.facingLeft = true; player1.HandleHorizontalOrientation(); player2.HandleHorizontalOrientation(); cameraController.players = new GameObject[2]; cameraController.players[0] = player1GameObject; cameraController.players[1] = player2GameObject; hitFeedP1.character = player1; hitFeedP2.character = player2; maxRounds = MatchSettings.Instance.MaxRounds; roundCounterP1.maxRounds = maxRounds; roundCounterP1.Initialize(); roundCounterP2.maxRounds = maxRounds; roundCounterP2.Initialize(); maxTime = MatchSettings.Instance.TimeLimit; time = maxTime; Invoke("SetupNewRound", 0.001f); }
void OnTriggerEnter(Collider other) { CharacterControler otherControl = other.gameObject.GetComponentInParent <CharacterControler>(); if (otherControl) { otherControl.OnTriggerWithOther(gameObject.GetComponentInParent <CharacterControler>()); } }
void Start() { m_animator = GetComponent <Animator>(); m_inputManager = InputManager.Instance; m_characterController = gameObject.GetComponent <CharacterControler>(); m_characterSpeed = GetComponent <Character>().Speed *m_dashSpeedMultiplier; m_body = GetComponent <Rigidbody>(); OnEnable(); }
private void Start() { playerRef = GameObject.FindWithTag("Player"); charContRef = playerRef.GetComponent <CharacterControler>(); playerLucContRef = playerRef.GetComponent <LucidityControl>(); rigBodRef = playerRef.GetComponent <Rigidbody>(); doubleJumpFlag = false; isDblJumping = false; }
// Use this for initialization void Awake() { owner = GetComponentInParent <CharacterControler>(); hitSpark = new GameObject[3]; hitSpark[0] = (GameObject)Resources.Load("Effects/HitSparkNormalHit"); hitSpark[1] = (GameObject)Resources.Load("Effects/HitSparkMediumHit"); hitSpark[2] = (GameObject)Resources.Load("Effects/HitSparkHeavyHit"); counterSpark = (GameObject)Resources.Load("Effects/CounterSpark"); animator = GetComponent <Animator>(); animator.Play(owner.hitFromFront?"ThrowFrontParticlesAnimation":"ThrowBackParticlesAnimation"); }
private void Start() { m_Character = GetComponent <CharacterControler>(); m_camObject = GameObject.FindWithTag("MainCamera"); m_camControl = m_camObject.GetComponent <v3rdPersonCamera>(); m_DrainRescourse = GetComponent <DrainLucidityAct>(); m_CastRescourse = GetComponent <SpendLucidityAct>(); m_mainCam = GameObject.FindWithTag("MainCamera").GetComponent <Camera>(); m_Cam = m_mainCam.transform; }
private void FindOtherChar() { CharacterControler[] characters = FindObjectsOfType <CharacterControler>(); if (characters[0] != this) { otherChar = characters[0]; } else { otherChar = characters[1]; } }
private void Start() { m_animator = GetComponent <Animator>(); m_manager = InputManager.Instance; OnEnable(); m_cControler = gameObject.GetComponent <CharacterControler>(); m_characterSpeed = GetComponent <Character>().Speed; if (m_consomationRatePerUse > m_gaugeBarMaxCapacity) { m_consomationRatePerUse = m_gaugeBarMaxCapacity; } }
private void Start() { if (m_dashForce == 0) { m_dashForce = 1000f; } m_rigBodRef = GetComponent <Rigidbody>(); particleRef = GameObject.Find("Empowered_DashEffect").GetComponent <ParticleSystem>(); playerLucRef = GameObject.FindWithTag("Player").GetComponent <LucidityControl>(); /*Empowered Dash Variable Initialization*/ m_charContRef = GetComponent <CharacterControler>(); }
private void OnCollisionEnter2D(Collision2D collision) { CharacterControler player = collision.gameObject.GetComponent <CharacterControler>(); if (player != null) { Hit_score.hitsNumber += 1; GameObject.Destroy(this.gameObject); } if (collision.gameObject.tag == "floor") { GameObject.Destroy(this.gameObject); } }
// Use this for initialization void Awake() { owner = GetComponentInParent <CharacterControler>(); hitSparkNormal = (GameObject)Resources.Load("Effects/HitSparkNormalHit"); hitSparkMedium = (GameObject)Resources.Load("Effects/HitSparkMediumHit"); hitSparkHeavy = (GameObject)Resources.Load("Effects/HitSparkHeavyHit"); counterSpark = (GameObject)Resources.Load("Effects/CounterSpark"); blockSpark = (GameObject)Resources.Load("Effects/BlockSpark"); audioSource = transform.root.GetComponents <AudioSource>()[0]; audioClips = new AudioClip[6]; audioClips[0] = (AudioClip)Resources.Load("SFX/Impacts_Processed-051"); audioClips[1] = (AudioClip)Resources.Load("SFX/Impacts_Processed-053"); audioClips[2] = (AudioClip)Resources.Load("SFX/Impacts_Processed-054"); audioClips[3] = (AudioClip)Resources.Load("SFX/Impacts_Processed-055"); audioClips[4] = (AudioClip)Resources.Load("SFX/Impacts_Processed-083"); audioClips[5] = (AudioClip)Resources.Load("SFX/Impacts_Processed-071"); }
private void CalculateMaleTargets() { // find one of the closest famale and set it as target for male foreach (CharacterControler male in _charactersMale) { float minDist = float.MaxValue; CharacterControler closestFemale = null; foreach (CharacterControler female in _charactersFemale) { float dist = Vector3.Distance(male.transform.position, female.transform.position); if (dist < minDist) { closestFemale = female; } } if (closestFemale != null) { male.SetDestination(closestFemale.gameObject.transform.position); } } }
void Update() { if (Input.GetMouseButton(0)) { Ray ray = _cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { //Destroy(hit.transform.gameObject); GameObject obj = hit.transform.gameObject; if (obj) { CharacterControler animal = obj.GetComponentInParent <CharacterControler>(); // bumb allowed only for males if (animal && animal.Sex == CharacterControler.SexEnum.Male) { animal.Bump(); } } } } }
public void GiveBonus(string tag, GameObject player) { switch (tag) { case "BonusHealth": PlayerHealth healtScript = player.GetComponent <PlayerHealth>(); if (healtScript != null) { healtScript.BonusHp(bonusHpAmount); } break; case "BonusSpeed": CharacterControler playerControl = player.GetComponent <CharacterControler>(); if (playerControl != null) { playerControl.BonusSpeed(bonusSpeedAmount); } break; } }
// Update is called once per frame void Update() { if (controlable) { GatherInput(); } else { ClearInput(); } HandleRigidBodyMass(); if (!isKOd) { if (currentHealth <= 0) { HandleKO(); } else { HandleThrowKnockout(); GetStanceButton(); if (throwBreakable) { ListenForThrowBreak(); } if (!isInThrow) { if (otherChar != null) { otherChar = null; } if (!isInHitStun) { consecutiveHits = 0; comboDamage = 0; GatherCombatInput(); if (!isInBlockStun) { if (isStuckToWall) { HandleWallInteraction(); } else { HandleMovement(); } HandleAttack(); HandleAerialAttackPrematureLanding(); } else { HandlePushBack(); } HandleDoubleTapDash(); } else { HandlePushBack(); } } HandleAnimation(); } } else { HandleGeneralCollider(); } }
// Start is called before the first frame update void Start() { owner = this.GetComponent <CharacterControler>(); }
// Use this for initialization void Start() { owner = GetComponentInParent <CharacterControler>(); colliders = GetComponents <Collider>(); }
// Use this for initialization void Start() { UnityAction[] tabFonctions = { functionButtonDemarrer, functionButtonPosteTravail, functionButtonInternet, functionButtonDiablo, //fonction du bureau functionBoutonShutdown, functionButtonPosteTravail, functionButtonInternet, functionButtonDiablo, functionButtonInvCommande, functionButtonTousProgs, // fonction de demarrer functionFermer, functionButtonChance, functionButtonRecherche, // fonction de google1 functionFermer, functionPrecedent, // fonction de google2 functionFermer, functionButtonPhotoLouche, // fonction de poste travail functionFermer, functionButtonPlayDiablo, // fonction de diablo functionFermer, // fonction de diablo Warning functionFermer, functionPrecedent, functionButtonBeauMec, // fonction de PhotoWindow functionFermer, // fonction de BeauMec functionFermer, // FN de command Prompt functionButtonAcceptUpdate, functionButtonRefuseUpdate, // fonction de VictoryPopUp functionButtonAcceptUpdate }; // fonction de ForceUpdate listButtons = this.GetComponentsInChildren <Button>(); for (int i = 0; i < listButtons.Length; i++) { listButtons[i].onClick.AddListener(tabFonctions[i]); listButtons[i].onClick.AddListener(playClick); } Debug.Log(listButtons.Length); panelFlou.SetActive(false); allowClickPhoto = true; ralentir1 = true; ralentir2 = true; ralentir3 = true; player = GameObject.Find("Player").GetComponent <CharacterControler>(); contenuScroll = GameObject.Find("Content").GetComponent <TextScrollview>(); // Colomne Démarrer Initialisation colomneDemarrer = this.transform.Find("colomneDemarrer").gameObject; boolDemarrer = false; colomneDemarrer.SetActive(boolDemarrer); // Google Initialisation google = this.transform.Find("Google").gameObject; boolGoogle = false; google.SetActive(boolGoogle); google2 = this.transform.Find("ChanceResult").gameObject; boolGoogle2 = false; google2.SetActive(boolGoogle2); //sons audioSource = GetComponents <AudioSource>()[0]; audioBoot = GetComponents <AudioSource>()[1]; audioError = GetComponents <AudioSource>()[2]; audioBoot.Play(); // Poste de Travail Initialisation posteTravail = this.transform.Find("PostTravail").gameObject; boolPosteTravail = false; posteTravail.SetActive(boolPosteTravail); // Diablo Initialisation diablo = this.transform.Find("Diablo").gameObject; boolDiablo = false; diablo.SetActive(boolDiablo); // Diablo Warning Initialisation diabloWarning = this.transform.Find("Warning").gameObject; boolDiabloWarning = false; diabloWarning.SetActive(boolDiabloWarning); // PhotoWindow Initialisation photoWindow = this.transform.Find("PhotoWindow").gameObject; boolPhotoWindow = false; photoWindow.SetActive(boolPhotoWindow); cmdPrompt = this.transform.Find("commandPrompt").gameObject; boolCmdPrompt = false; cmdPrompt.SetActive(boolCmdPrompt); // BeauMec.png Initialisation beauMec = this.transform.Find("BeauMec").gameObject; boolBeauMec = false; beauMec.SetActive(boolBeauMec); // VictoryPopUp Initialisation victoryPop = this.transform.Find("VictoryPopUp").gameObject; boolVictoryPop = false; victoryPop.SetActive(boolVictoryPop); // ForceUpdate Initialisation forceUpdate = this.transform.Find("ForceUpdate").gameObject; boolForceUpdate = false; forceUpdate.SetActive(boolForceUpdate); // Desactiver virus dans la scene virus1 = GameObject.Find("ParticulePoussiere1"); virus2 = GameObject.Find("ParticulePoussiere2"); virus3 = GameObject.Find("ParticulePoussiere3"); virus4 = GameObject.Find("ParticulePoussiere4"); virus5 = GameObject.Find("ParticulePoussiere5"); virus6 = GameObject.Find("ParticulePoussiere6"); boolPart = false; virus1.SetActive(boolPart); virus2.SetActive(boolPart); virus3.SetActive(boolPart); virus4.SetActive(boolPart); virus5.SetActive(boolPart); virus6.SetActive(boolPart); }
//AnimationEvent void Start() { c_animator = GetComponent <Animator>(); charContRef = GameObject.FindWithTag("Player").GetComponent <CharacterControler>(); c_animator.ResetTrigger(attackHash); }
public void OnTriggerWithOther(CharacterControler other) { // code allowed only for JAM (not production one) gameObject.transform.parent.gameObject.GetComponentInParent <GameField>().OnTwoAnimalsWantToPlay(this, other); }
// Use this for initialization void Start() { enemyChar = enemyTrans.gameObject.GetComponent <CharacterControler>(); ownMat = GetComponent <MeshRenderer>().sharedMaterial; }
private void CheckHit(Collider other) { if ((limbLabel == owner.activeLimb) || ((limbLabel == "LeftPunch" || limbLabel == "RightPunch") && owner.activeLimb == "Throw")) { if (owner.activeFrames) { if (other.gameObject.tag == "Damagable") { CharacterControler otherCharacter = other.gameObject.GetComponentInParent <CharacterControler>(); if (otherCharacter != null && otherCharacter != owner && !otherCharacter.invulnerable && !otherCharacter.isKOd) { if ((otherCharacter.facingLeft && otherCharacter.transform.position.x > owner.transform.position.x) || (!otherCharacter.facingLeft && otherCharacter.transform.position.x < owner.transform.position.x)) { otherCharacter.hitFromFront = true; } else { otherCharacter.hitFromFront = false; } if (owner.activeLimb == "Throw") { if (other.gameObject.name == "Head" || other.gameObject.name == "UpperSpine" || other.gameObject.name == "LowerSpine") { if (!otherCharacter.isCrouching && otherCharacter.grounded) { owner.InvocationOInvulnerability(); owner.activeFrames = false; otherCharacter.StartTheThrow(owner); } } } else if (otherCharacter.CheckBlockCondition(owner.outputBlockType)) { owner.animator.SetFloat("onBlockModifier", 0.5f); owner.activeFrames = false; var blockSparkPos = other.gameObject.GetComponent <Collider>().ClosestPointOnBounds(transform.position); blockSparkPos = new Vector3(other.transform.root.transform.position.x + (otherCharacter.facingLeft ? -1.2f : 1.2f), blockSparkPos.y, sparkZOffset); PlayBlockEffect(blockSparkPos); otherCharacter.ApplyBlockStun(owner.outputBlockStun, other.transform.name, owner.outputPushBack); } else { owner.activeFrames = false; owner.outgoingAttackLanded = true; var hitSparkPos = other.gameObject.GetComponent <Collider>().ClosestPointOnBounds(gameObject.GetComponent <Collider>().ClosestPointOnBounds(other.transform.position)); if (otherCharacter.isAttacking) { otherCharacter.isAttacking = false; otherCharacter.countered = true; PlayCounterHitEffect(hitSparkPos); } else { otherCharacter.countered = false; } PlayHitEffect(hitSparkPos, (int)((owner.countered ? 1.2f : 1) * owner.outputDamage)); otherCharacter.ApplyHitStun(owner.outputHitStun, other.transform.name, owner.outputPushBack, owner.outputDamage); } } } } } }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); parentRb = transform.parent.GetComponent <Rigidbody>(); controller = transform.parent.GetComponent <CharacterControler>(); }
private void Awake() { m_Character = GetComponent <CharacterControler>(); }
// Use this for initialization private void Awake() { character = transform.root.GetComponent <CharacterControler>(); }