Example #1
0
 private void Awake()
 {
     instance          = this;
     playerMain        = GetComponent <PlayerMain>();
     characterBase     = gameObject.GetComponent <Character_Base>();
     material          = transform.Find("Body").GetComponent <MeshRenderer>().material;
     materialTintColor = new Color(1, 0, 0, 0);
 }
Example #2
0
 private void Awake()
 {
     playerSword                   = GetComponent <PlayerSword>();
     levelSystem                   = new LevelSystem();
     levelSystemAnimated           = new LevelSystemAnimated(levelSystem);
     playerSkills                  = new PlayerSkills();
     playerSkills.OnSkillUnlocked += PlayerSkills_OnSkillUnlocked;
 }
Example #3
0
 void Start()
 {
     InventoryGUI     = GameObject.FindGameObjectWithTag("InventoryGUI");
     weaponSlot       = GameObject.FindGameObjectWithTag("Player").transform.Find("SwordSlot").gameObject;
     weaponToolTip    = InventoryGUI.transform.Find("Weapon Tool Tip").gameObject;
     playerSwordSlot  = GameObject.FindGameObjectWithTag("SwordSlot").GetComponent <PlayerSword>();
     playerShieldSlot = GameObject.FindGameObjectWithTag("ShieldSlot").GetComponent <PlayerShield>();
 }
Example #4
0
    void Start()
    {
        attackBoots  = GetComponent <PlayerBoots>();
        attackHelmet = GetComponent <PlayerHelmet>();
        attackSword  = sword.GetComponent <PlayerSword>();

        attackBoots.enabled  = false;
        attackHelmet.enabled = false;
        attackSword.enabled  = false;

        sword.SetActive(false);
    }
Example #5
0
    private void Awake()
    {
        Instance    = this;
        playerBase  = GetComponent <Player_Base>();
        playerPunch = GetComponent <PlayerPunch>();
        playerSword = GetComponent <PlayerSword>();

        playerBase.enabled  = true;
        playerPunch.enabled = false;
        playerSword.enabled = false;

        healthPotionAmount = 1;
    }
Example #6
0
    private void Awake()
    {
        characterAimBase = GetComponent <CharacterAim_Base>();
        playerAim        = GetComponent <PlayerAim>();
        playerBase       = GetComponent <Player_Base>();
        playerPunch      = GetComponent <PlayerPunch>();
        playerSword      = GetComponent <PlayerSword>();

        playerBase.enabled  = false;
        playerPunch.enabled = false;
        playerSword.enabled = false;

        characterAimBase.OnShoot += CharacterAimBase_OnShoot;
    }
Example #7
0
    void ThrowGrenade()
    {
        GameObject  instantiatedProjectile = Instantiate(bomb, throwPoint.gameObject.transform.position, gameObject.transform.rotation) as GameObject;
        Rigidbody2D rb = instantiatedProjectile.GetComponent <Rigidbody2D> ();

        if (Mm.facingright)
        {
            rb.AddForce(transform.right * throwForce, ForceMode2D.Impulse);
        }
        else if (Mm.facingright == false)
        {
            rb.AddForce(-transform.right * throwForce, ForceMode2D.Impulse);
        }

        gameObject.SetActive(false);
        PlayerSword.SetActive(true);
    }
Example #8
0
 public void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Inventory.Instance.EquipItem(Inventory.Instance.EquippedWeapon.ItemId);
         _playerSword = _swordParent.GetComponentInChildren <PlayerSword>();
         _animator.SetTrigger("Attack");
         _playerSword.Attack();
     }
     else if (Input.GetMouseButtonDown(1))
     {
         _animator.SetBool("Defensive", true);
     }
     else if (Input.GetMouseButtonUp(1))
     {
         _animator.SetBool("Defensive", false);
     }
 }
Example #9
0
    [HideInInspector] public bool commandSwitching;      //don't allow commands while switching



    // Use this for initialization
    void Awake()
    {
        switch (numCommands)
        {
        case 2:
            Instantiate(HUD [0]);
            break;

        case 3:
            Instantiate(HUD [1]);
            break;
            //etc
        }
        canDash     = true;
        hasSword    = true;
        dashing     = false;
        attackCombo = new bool[COMBONUM];
        attacking   = false;
        attackLock  = true;
        dashCharges = numDashes;
        Physics2D.IgnoreLayerCollision(8, 9, false);                                    //prevent invincability by dashing into transition
        for (int i = 0; i < COMBONUM; i++)
        {
            attackCombo[i] = false;
        }
        canAttack = true;
        pm        = GetComponent <PlayerMovement> ();
        sfx       = GetComponent <SFXManager> ();
        rb        = GetComponent <Rigidbody2D> ();
        an        = GetComponent <Animator> ();
        gs        = GetComponent <GhostSprites> ();
        ps        = GetComponentInChildren <PlayerSword> ();
        ph        = GameObject.FindGameObjectWithTag("HUD").GetComponent <PlayerHUD> ();
        php       = GetComponent <PlayerHealth> ();
        php.ph    = ph;
        for (int i = 0; i < numCommands; i++)
        {
            commands [i] = Instantiate(commandsOriginals [chosenCommands[i]]).GetComponent <PlayerCommand>();
        }
        gs.ClearTrail();
        selectedCommand = 1;
        canCommand      = true;
        damageColliderOriginalOffset = php.damageCollider.offset;
    }
Example #10
0
 // Use this for initialization
 public void OnStart()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     pm     = player.GetComponent <PlayerMovement> ();
     rb     = player.GetComponent <Rigidbody2D> ();
     an     = player.GetComponent <Animator> ();
     ps     = player.GetComponentInChildren <PlayerSword> ();
     ph     = GameObject.FindGameObjectWithTag("HUD").GetComponent <PlayerHUD> ();
     php    = player.GetComponent <PlayerHealth> ();
     pc     = player.GetComponent <PlayerCombat> ();
     //rechargeDelay = 0;
     if (rechargeDelay <= 0)
     {
         canUse = true;
     }
     else
     {
         canUse = false;
     }
 }
Example #11
0
    protected override void PickUpObject(GameObject other)
    {
        base.PickUpObject(other);
        PickUpManager manager        = other.GetComponent <PickUpManager>();
        PlayerSword   swordComponent = sword.GetComponentInChildren <PlayerSword>();

        if (swordComponent.tagCustom == "Weapon")
        {
            if (manager.Weapons.Count <= 5)
            {
                manager.Weapons.Add(sword);
            }
            else
            {
                return;
            }
        }
        swordComponent.weaponDamage   = setDamage;
        swordComponent.knockBackForce = setKnockBack;
        swordComponent.name           = setName;
        swordComponent.tagCustom      = setTag;
        Destroy(this.gameObject);
    }