예제 #1
0
    [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
            }
        }
    }
예제 #2
0
    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;
        }
    }
예제 #3
0
    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;
    }
예제 #4
0
 public BattleTracker(params WarPlayer[] players)
 {
     foreach (WarPlayer player in players)
     {
         PlayerAttacks.Add(player, new CardList());
     }
 }
예제 #5
0
    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);
        }
    }
예제 #6
0
파일: Player.cs 프로젝트: jamioflan/LD48
 void Awake()
 {
     inst      = this;
     movement  = GetComponent <PlayerCapitalMovement>();
     attacks   = GetComponent <PlayerAttacks>();
     inventory = GetComponent <PlayerInventory>();
 }
예제 #7
0
 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);
     }
 }
예제 #8
0
    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>();
    }
예제 #9
0
    public void Pickup(Collider2D player)
    {
        Debug.Log("Sword Activated!");
        PlayerAttacks damage = player.GetComponent <PlayerAttacks>();

        damage.damage = 10;
        Destroy(gameObject);
    }
예제 #10
0
 void Start()
 {
     triangleLook   = GetComponentInChildren <LookatMouse>();
     barStuffHolder = GameObject.Find("StuffHolder");
     overlay        = GameObject.Find("Overlay");
     playerControl  = GetComponent <PlayerController>();
     playerAttack   = GetComponent <PlayerAttacks>();
     //	currentEnergy=maxEnergy;
 }
예제 #11
0
    void Awake()
    {
        // Set up references
        playerBehavior = GetComponent<PlayerBehavior>();
        playerStats = GetComponent<PlayerStats>();
        playerAttacks = GetComponent<PlayerAttacks>();
        navigation = GetComponent<NavMeshAgent>();

        References.stateManager.changeState += onStateChange;
    }
예제 #12
0
    /// <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;
        }
    }
예제 #13
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag(Tags.player))
     {
         PlayerAttacks typeOfPlayer = collision.gameObject.GetComponent <PlayerAttacks>();
         if (!(typeOfPlayer is NekoMaidAttacks))
         {
             typeOfPlayer.isInNekoComboField = true;
         }
     }
 }
예제 #14
0
 public void ManualUpdate(PlayerAttacks source)
 {
     if (!_isCasting)
     {
         UpdateNotCasting(source);
     }
     else
     {
         UpdateCasting(source);
     }
 }
예제 #15
0
//}

    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;
    }
예제 #16
0
    protected virtual IEnumerator EndAttack()
    {
        if (currentAttackCoroutine != null)
        {
            StopCoroutine(currentAttackCoroutine);
        }

        CharacterAnimator.SetInteger("State", 0);

        yield return(null);

        currentAttack = PlayerAttacks.None;
        isStroking    = false;
    }
예제 #17
0
    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");
    }
예제 #18
0
    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;
    }
예제 #19
0
 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);
     }
 }
예제 #20
0
    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();
        }
    }
예제 #21
0
 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;
    }
예제 #23
0
    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;
        }
    }
예제 #24
0
    // 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
    }
예제 #25
0
    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;
                }
            }
        }
    }
예제 #26
0
 // Use this for initialization
 void Start()
 {
     controllerRef = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
     controlsRef   = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <RunJump>();
     attackBoolRef = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <PlayerAttacks>();
 }
예제 #27
0
 private void Start()
 {
     runJumpRef = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <RunJump>();
     _attacks   = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <PlayerAttacks>();
 }
예제 #28
0
 private void Start()
 {
     _movement = GetComponentInParent <PlayerMovement>();
     _attacks  = GetComponentInParent <PlayerAttacks>();
 }
예제 #29
0
 private void Start()
 {
     parent           = GetComponentInParent <PlayerAttacks>();
     parentController = GetComponentInParent <PlayerController>();
     parentHealth     = GetComponentInParent <PlayerHealth>();
 }
	void Awake () {
		playerAttack = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerAttacks> ();
	}
예제 #31
0
 public BattleService(DataContext dataContext, MonsterAttacks monsterAttacks, PlayerAttacks playerAttacks)
 {
     _dataContext    = dataContext;
     _monsterAttacks = monsterAttacks;
     _playerAttacks  = playerAttacks;
 }
예제 #32
0
 // Set up references
 void Awake()
 {
     playerStats = GetComponent<PlayerStats>();
     playerMovement = GetComponent<PlayerMovement>();
     playerAttacks = GetComponent<PlayerAttacks>();
 }