[Command] public void CmdISelected(int index) { GameObject[] players1 = GameObject.FindGameObjectsWithTag("Player"); Player_Sync thisPS = GetComponent <Player_Sync>(); if (!thisPS) { return; } foreach (GameObject p in players1) { Player_Sync otherPS = p.GetComponent <Player_Sync>(); if (!otherPS) { continue; } if (thisPS.team == otherPS.team) { PlayerAttacks otherPA = p.GetComponent <PlayerAttacks>(); if (!otherPA) { return; } otherPA.otherPlayerSelected = index; Debug.Log("server updated selected weapon on teamamte"); return;//finished everyting so we can stop and return } } }
public void CmdReviveDownedPlayer(GameObject player, float healingPercentage, string penalties) { PlayerAttacks plContr = player.GetComponent <PlayerAttacks>(); if (plContr is NekoMaidAttacks) { downedManager.StopCoroutine("NekoDownedTimer"); downedManager.nekoAlive = 1; downedManager.neko.RpcReviveFromDowned(healingPercentage, penalties); return; } if (plContr is OctoChefAttacks) { downedManager.StopCoroutine("OctoDownedTimer"); downedManager.octoAlive = 1; downedManager.octo.RpcReviveFromDowned(healingPercentage, penalties); return; } if (plContr is FishermanAttacks) { downedManager.StopCoroutine("FishDownedTimer"); downedManager.fishermanAlive = 1; downedManager.fisherman.RpcReviveFromDowned(healingPercentage, penalties); return; } }
void Awake() { // Setting up the references. playerMovement = GetComponent <PlayerMovement>(); Ani = GetComponent <Animator>(); AniClockHand = LastResortClockHand.GetComponent <Animator>(); PlayerAtt = GetComponent <PlayerAttacks>(); OverchargeScythe.gameObject.SetActive(false); // Set the initial health of the player. currentHealth = MaxHealth; //Set the initial overcharge energy of the player. currentOvercharge = 0; //Disabling Images LastResortClock.enabled = false; LastResortClockHand.enabled = false; TimeSlowVenue.gameObject.SetActive(false); Color alpha = OmegaUnavailable.color; alpha.a = 0; OmegaUnavailable.color = alpha; EventManager.OnPause += Pause; EventManager.OnUnpause += Unpause; }
public BattleTracker(params WarPlayer[] players) { foreach (WarPlayer player in players) { PlayerAttacks.Add(player, new CardList()); } }
protected void UpdateNotCasting(PlayerAttacks source) { _cooldownTimer -= Time.deltaTime; if (_charges < _maxCharges && _cooldownTimer < 0.0f) { ++_charges; _cooldownTimer += _cooldown; } if (_wasCanceled) { _cancelCooldownTimer += Time.deltaTime; if (_cancelCooldownTimer > _cancelCooldown) { _cancelCooldownTimer = 0f; _wasCanceled = false; source.AnimateCurrentAttackCooldown(1f, 0f); } else { source.AnimateCurrentAttackCooldown(_cancelCooldownTimer / _cancelCooldown, _cancelCooldown - _cancelCooldownTimer); } } else if (_charges < _maxCharges) { source.AnimateCurrentAttackCooldown((_cooldown - _cooldownTimer) / _cooldown, _cooldownTimer); } else { source.AnimateCurrentAttackCooldown(1f, 0f); } }
void Awake() { inst = this; movement = GetComponent <PlayerCapitalMovement>(); attacks = GetComponent <PlayerAttacks>(); inventory = GetComponent <PlayerInventory>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag(Tags.player)) { PlayerAttacks playerAttacks = collision.gameObject.GetComponent <PlayerAttacks>(); if (playerAttacks != null) { if (chipType == ConstantsDictionary.CHIP_TYPE.Normal) { float damageDealt = DamageFormulas.CalculateBasicAttackDamage(attackDamage, playerAttacks.m_defense, ConstantsDictionary.randomK, 1f); playerAttacks.gameObject.GetComponent <PlayerHealth>().CmdTakeDamage(damageDealt); } else if (chipType == ConstantsDictionary.CHIP_TYPE.Ketchup) { playerAttacks.gameObject.GetComponent <PlayerHealth>().CmdTakeDamage(abilityDamage + ketchupDamage); } else if (chipType == ConstantsDictionary.CHIP_TYPE.Mayonnaise) { playerAttacks.gameObject.GetComponent <PlayerHealth>().CmdTakeDamage(abilityDamage); playerAttacks.gameObject.GetComponent <PlayerController>().SpeedChange(-0.5f, mayonnaiseDuration); } } NetworkServer.Destroy(gameObject); } if (collision.gameObject.CompareTag(Tags.building)) { NetworkServer.Destroy(gameObject); } }
private void Start() { StartCoroutine(AllLoaded()); if (!isLocalPlayer) { gameObject.GetComponentInChildren <Camera>().enabled = false; } characterAttacks = GetComponent <PlayerAttacks>(); rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); anim.SetFloat("Speed", 1.0f); downedCollider = GetComponent <CircleCollider2D>(); m_speed = characterAttacks.m_speed; m_normal_speed = m_speed; sushi_coins = 0; ultimate_charge = 0; skillOneCooldown = characterAttacks.skillOneCooldown; skillTwoCooldown = characterAttacks.skillTwoCooldown; downedTime = ConstantsDictionary.MaxDownedTime; Slider[] DownedTimerSliders = GetComponentsInChildren <Slider>(); foreach (Slider slider in DownedTimerSliders) { if (slider.gameObject.name.Contains("Neko")) { nekoDownedTimerSlider = slider; } else if (slider.gameObject.name.Contains("Octo")) { octoDownedTimerSlider = slider; } else if (slider.gameObject.name.Contains("Fisherman")) { fishermanDownedTimerSlider = slider; } } nekoDownedTimerSlider.maxValue = downedTime; octoDownedTimerSlider.maxValue = downedTime; fishermanDownedTimerSlider.maxValue = downedTime; nekoArrow.SetActive(false); octoArrow.SetActive(false); fishermanArrow.SetActive(false); lastMove = new Vector2(0, -1); playerMoving = false; anim.SetBool("Moving", playerMoving); ultimateChargeSlider = GameObject.FindGameObjectWithTag("UI").GetComponentInChildren <Slider>(); ultimateChargeSlider.value = 0; ultimateChargeSlider.GetComponent <Text>().text = "0%"; stm = gameObject.GetComponent <SkillTreeManager>(); }
public void Pickup(Collider2D player) { Debug.Log("Sword Activated!"); PlayerAttacks damage = player.GetComponent <PlayerAttacks>(); damage.damage = 10; Destroy(gameObject); }
void Start() { triangleLook = GetComponentInChildren <LookatMouse>(); barStuffHolder = GameObject.Find("StuffHolder"); overlay = GameObject.Find("Overlay"); playerControl = GetComponent <PlayerController>(); playerAttack = GetComponent <PlayerAttacks>(); // currentEnergy=maxEnergy; }
void Awake() { // Set up references playerBehavior = GetComponent<PlayerBehavior>(); playerStats = GetComponent<PlayerStats>(); playerAttacks = GetComponent<PlayerAttacks>(); navigation = GetComponent<NavMeshAgent>(); References.stateManager.changeState += onStateChange; }
/// <summary> /// Outputs an attack, controlled by an attack system. Intended to be activated when the attack went through. Can not be activated by Value-like nodes. /// </summary> public static void SetState_OutNode(Node prevNode, Node node, ref NodeGraph graph, bool state, float baseval) { if (node.Active) { return; } if (IsValueHoldingNode(prevNode)) { return; } node.Active = state; int id = graph.GetIdFromNode(node); var spd = .001f; var dmg = .001f; var type = 0f; var status = -1f; foreach (var potentialAffector in graph.NodeDict) { if (!potentialAffector.Value.ConnectedNodes.Contains(id)) { continue; } switch (potentialAffector.Value.Node_text) { case "DMG": dmg = Mathf.Max(dmg, potentialAffector.Value.Value); continue; case "SPD": spd = Mathf.Max(spd, potentialAffector.Value.Value); continue; case "TYPE": type = potentialAffector.Value.Value; continue; case "STAT": status = potentialAffector.Value.Value; break; default: continue; } } // checks if the attack can go trough, if it can't this node won't activate node.Active = PlayerAttacks.ProccessAttackNode(spd, dmg, (int)type, node, (int)status); if (Callbacks.Count != 0 && Callbacks.Peek().Activator == null) { Callbacks.Peek().Activator = node; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag(Tags.player)) { PlayerAttacks typeOfPlayer = collision.gameObject.GetComponent <PlayerAttacks>(); if (!(typeOfPlayer is NekoMaidAttacks)) { typeOfPlayer.isInNekoComboField = true; } } }
public void ManualUpdate(PlayerAttacks source) { if (!_isCasting) { UpdateNotCasting(source); } else { UpdateCasting(source); } }
//} void Start() { playerGameObject = GameObject.FindWithTag("Player"); playerAttacks = playerGameObject.GetComponent <PlayerAttacks>(); playerTransform = playerGameObject.GetComponent <Transform>(); enemyMove = GetComponent <EnemyMove>(); enemyAttacks = GetComponent <EnemyAttacks>(); enemyTransform = GetComponent <Transform>(); ToggleAI = true; updateState = true; canAttack = true; decisionRate = 1f; }
protected virtual IEnumerator EndAttack() { if (currentAttackCoroutine != null) { StopCoroutine(currentAttackCoroutine); } CharacterAnimator.SetInteger("State", 0); yield return(null); currentAttack = PlayerAttacks.None; isStroking = false; }
void Start() { playerAttacks = GetComponent <PlayerAttacks>(); playerManager = GetComponent <PlayerManager>(); playerSounds = GetComponent <PlayerSounds>(); playerRB = GetComponent <Rigidbody2D>(); collider = GetComponent <BoxCollider2D>(); CalculateRaySpacing(); glideGravity = gravity / 3; scaleChange = transform.localScale; //playerManager.powerUps.Dash = true; //Placeholder testi, näkee vaan että managerin struct toimii animator = animPlayer.GetComponent <Animator>(); ChangeAnimationState("Silkie_Idle"); }
public IEnumerator ApplyWeakness(float percentage, int duration) { PlayerAttacks playerAttacks = GetComponent <PlayerAttacks>(); int timePassed = 0; float amount = playerAttacks.m_basic_attack_damage * percentage / 100f; playerAttacks.m_basic_attack_damage -= amount; while (timePassed < duration) { yield return(new WaitForSeconds(1f)); timePassed++; } playerAttacks.m_basic_attack_damage += amount; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag(Tags.player)) { PlayerAttacks playerAttacks = collision.gameObject.GetComponent <PlayerAttacks>(); if (playerAttacks != null) { float damageDealt = DamageFormulas.CalculateBasicAttackDamage(attackDamage, playerAttacks.m_defense, ConstantsDictionary.randomK, 1f); playerAttacks.gameObject.GetComponent <PlayerHealth>().CmdTakeDamage(damageDealt); playerAttacks.gameObject.GetComponent <PlayerController>().SpeedChange(-0.5f, oilSlowDuration); } NetworkServer.Destroy(gameObject); } if (collision.gameObject.CompareTag(Tags.building)) { NetworkServer.Destroy(gameObject); } }
private void UpdateCasting(PlayerAttacks source) { _castTimer += Time.deltaTime; Color playerCol = _playerMat.GetColor("_Color"); playerCol.g = _castTimer / _castTime; playerCol.r = 0.0f; playerCol.b = playerCol.r; _playerMat.SetColor("_Color", playerCol); if (_castTimer > _castTime) { --_charges; if (_cooldownTimer < 0.0f) { _cooldownTimer = _cooldown; } OnCastFinish(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag(Tags.player)) { PlayerAttacks playerAttacks = collision.gameObject.GetComponent <PlayerAttacks>(); if (playerAttacks != null) { float damageDealt = DamageFormulas.CalculateBasicAttackDamage(attackDamage, playerAttacks.m_defense, ConstantsDictionary.randomK, 1f); playerAttacks.gameObject.GetComponent <PlayerHealth>().CmdTakeDamage(damageDealt); if (miniBoss) { playerAttacks.gameObject.GetComponent <PlayerHealth>().TakeDotDamage(poisonPercentage, poisonDuration, poisonTick); } } NetworkServer.Destroy(gameObject); } if (collision.gameObject.CompareTag(Tags.building)) { NetworkServer.Destroy(gameObject); } }
void Start() { playerSR = GetComponent <SpriteRenderer>(); playerRB = GetComponent <Rigidbody2D>(); //anim = GetComponent<Animator>(); PA = GetComponent <PlayerAttacks>(); speed = 12f; airSpeed = 100f; jumpHeight = 1000f; dashSpeed = 100f; dashCD = .3f; dashDur = .3f; facingLeft = false; canMove = true; canDash = true; jumping = false; dashing = false; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "AtaqueBasico") { PlayerAttacks playerDmg = player.GetComponent <PlayerAttacks>(); if (rb2D.transform.position.x > player.transform.position.x) { Rigidbody2D rb = rb2D.GetComponent <Rigidbody2D>(); rb.AddForce(new Vector2(5, 0) * (playerDmg.forcedanobasico), ForceMode2D.Impulse); } if (rb2D.transform.position.x < player.transform.position.x) { Rigidbody2D rb = rb2D.GetComponent <Rigidbody2D>(); rb.AddForce(new Vector2(-5, 0) * (playerDmg.forcedanobasico), ForceMode2D.Impulse); } ActualHP -= playerDmg.danobasico; } }
// Called before Start void Awake() { //create a playerControls object with which to bind inputs controls = new PlayerControls(); //handles the character's movement and interactions in physical space rb = GetComponent <Rigidbody>(); //Handles the character's collisions with terrain and hit boxes coll = GetComponent <Collider>(); //get location of the camera focus, this may be redundant if we go the fixed camera route cameraTransform = cameraFocus.GetComponent <Transform>(); //Get the specific player movement and attacks class attached to the current player. playerAttacks = GetComponent <PlayerAttacks>(); playerSpecials = GetComponent <PlayerSpecials>(); #region Input Bindings //Bind walk input to a vector between (1,1) and (-1,-1) controls.PlayerMovement.Walk.performed += ctx => moveInput = ctx.ReadValue <Vector2>(); //Cancel walk input by returning vector to (0,0) controls.PlayerMovement.Walk.canceled += ctx => moveInput = Vector2.zero; //Tracks when the player presses the attack button controls.PlayerMovement.Attack.performed += ctx => AttackInput(); //Tracks whether the player is pressing the special button or not controls.PlayerMovement.Special.performed += ctx => SpecialInput(); controls.PlayerMovement.Special.canceled += ctx => CancelSpecialInput(); //Tracks when the player is pressing the dash button controls.PlayerMovement.Dash.started += ctx => DashInput(); //Tracks when the player is presses the jump button controls.PlayerMovement.Jump.performed += ctx => JumpInput(); #endregion }
void OnTriggerStay2D(Collider2D col) { //on ground, attempt to pick up if (!held) { if (cooldown <= 0.0f) { if (col.tag == "Player") { PlayerAttacks player = col.GetComponentInChildren <PlayerAttacks>(); if (GetOwner() == null && player.CanAttack() && !player.HasWeapon()) { player.SwitchWeapon(transform); } } } } //held, so it's an attack else if (held && !doneDamage) { Debug.Log("Trying to attack"); Debug.Log(col.tag); Debug.Log(col.name); if (col.gameObject.tag == "Player") { Debug.Log("Player detected"); PlayerController player = col.GetComponentInChildren <PlayerController>(); if (GetOwner().GetComponentInChildren <PlayerController>() != player) { player.takeDamage(damage); Debug.Log("aaa"); doneDamage = true; } } } }
// Use this for initialization void Start() { controllerRef = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); controlsRef = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <RunJump>(); attackBoolRef = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <PlayerAttacks>(); }
private void Start() { runJumpRef = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <RunJump>(); _attacks = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <PlayerAttacks>(); }
private void Start() { _movement = GetComponentInParent <PlayerMovement>(); _attacks = GetComponentInParent <PlayerAttacks>(); }
private void Start() { parent = GetComponentInParent <PlayerAttacks>(); parentController = GetComponentInParent <PlayerController>(); parentHealth = GetComponentInParent <PlayerHealth>(); }
void Awake () { playerAttack = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerAttacks> (); }
public BattleService(DataContext dataContext, MonsterAttacks monsterAttacks, PlayerAttacks playerAttacks) { _dataContext = dataContext; _monsterAttacks = monsterAttacks; _playerAttacks = playerAttacks; }
// Set up references void Awake() { playerStats = GetComponent<PlayerStats>(); playerMovement = GetComponent<PlayerMovement>(); playerAttacks = GetComponent<PlayerAttacks>(); }