Example #1
0
 // Start is called before the first frame update
 void Start()
 {
     playerMovement  = GetComponent <PlayerMovement>();
     playerAttacking = GetComponent <PlayerAttacking>();
     mouseMovement   = GetComponentInChildren <MouseMovement>();
     powersHotkey    = GetComponent <PowersHotkey>();
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     spriteRenderer  = GetComponent <SpriteRenderer>();
     movement        = GetComponent <PlayerMovement> ();
     attacking       = GetComponent <PlayerAttacking> ();
     healthText.text = ("HP: " + curHealth);
 }
Example #3
0
 void Start()
 {
     movement  = GetComponent <PlayerMovement>();
     rotation  = GetComponent <PlayerRotation>();
     attacking = GetComponent <PlayerAttacking>();
     boxCheck  = GetComponent <PlayerBoxCheck>();
     rb        = GetComponent <Rigidbody>();
 }
Example #4
0
 void Awake()
 {
     attacking         = GetComponent <PlayerAttacking>();
     playerInventory   = GetComponent <PlayerInventory>();
     playerManager     = GetComponent <PlayerManager>();
     weaponSlotManager = GetComponentInChildren <WeaponSlotManager>();
     uiManager         = FindObjectOfType <UIManager>();
 }
    // Use this for initialization
    void Start()
    {
        inv          = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
        playerAttack = inv.GetComponent <PlayerAttacking>();

        rectTransform = (RectTransform)transform;

        setPosition(cIndex);
    }
	// Use this for initialization
	void Start () {

        inv = GameObject.FindGameObjectWithTag("Player").GetComponent<Inventory>();
        playerAttack = inv.GetComponent<PlayerAttacking>();

        rectTransform = (RectTransform)transform;

        setPosition(cIndex);
    }
Example #7
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        imagePoint = player.transform.FindChild("ImagePoints").FindChild("ImagePoint").transform;

        playerAnimator = player.GetComponent <Animator>();

        playerAtkScript = player.GetComponent <PlayerAttacking>();
        attackDelay     = 0.25f;
        attackHash      = Animator.StringToHash("Base Layer.BowAttack");
    }
Example #8
0
 // Use this for initialization
 void Start()
 {
     enemy                   = enemy.GetComponent <Animator>();
     choicePanel             = GameObject.Find("Choice Panel");
     playerMovement          = GameObject.Find("Player").GetComponent <PlayerMovement> ();
     playerAttacking         = GameObject.Find("PlayerAttack").GetComponent <PlayerAttacking> ();
     playerSpecial           = GameObject.Find("PlayerSpecial").GetComponent <PlayerSpecial> ();
     playerItem              = GameObject.Find("Player").GetComponent <PlayerItem> ();
     playerMovement.enabled  = false;
     playerAttacking.enabled = false;
     phase                   = battlePhase.Choice;
     // Debug.Log ("Current Phase: " + phase);
 }
    // Use this for initialization
    void Start()
    {
        player       = GetComponent <Rigidbody2D>();
        pauseScript  = FindObjectOfType <Pause>();
        attackScript = GetComponent <PlayerAttacking>();


        if (!playerExists)
        {
            playerExists = true;
            DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
	// Use this for initialization
	void Start () {
        player = GetComponent<Rigidbody2D>();
        pauseScript = FindObjectOfType<Pause>();
        attackScript = GetComponent<PlayerAttacking>();


        if (!playerExists)
        {
            playerExists = true;
            DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

	
	}
Example #11
0
    void Start()
    {
        cam = FindObjectOfType <CameraShake>();

        player = GameObject.FindGameObjectWithTag("Player");

        hitbox = gameObject.GetComponent <BoxCollider2D>();

        imagePoint = player.transform.FindChild("ImagePoints").FindChild("ImagePoint").transform;

        playerAnimator = player.GetComponent <Animator>();

        playerAtkScript = player.GetComponent <PlayerAttacking>();

        damage      = -2;
        knockback   = 8f;
        stun        = 0.5f;
        attackDelay = 0.35f;
        attackHash  = Animator.StringToHash("Base Layer.SwordAttack");
    }
Example #12
0
    private void Update()
    {
        timebetweenattacks -= Time.deltaTime;
        timeBetweenSword   -= Time.deltaTime;

        if (Input.GetMouseButton(0))
        {
            switch (attacktodo)
            {
            case AttackToDo.melee:
            {
                if (timebetweenattacks < 0)
                {
                    MeleeAttack();
                    timebetweenattacks = starttimebetweenattacks;
                    PlayerAttacking?.Invoke();
                }
                break;
            }

            case AttackToDo.ranged:

                if (timeBetweenSword < 0)
                {
                    RangedAttack();
                    PlayerAttacking?.Invoke();
                    timeBetweenSword = startTimebetweenSword;
                }

                break;

            case AttackToDo.nothing: break;
            }
        }

        if (Input.GetMouseButtonDown(1))
        {
            //Debug.Log("Switching weapon");
            SwitchingWeapon();
        }
    }
Example #13
0
    void Start()
    {
        cam = FindObjectOfType<CameraShake>();

        player = GameObject.FindGameObjectWithTag("Player");

        hitbox = gameObject.GetComponent<BoxCollider2D>();

        imagePoint = player.transform.FindChild("ImagePoints").FindChild("ImagePoint").transform;

        playerAnimator = player.GetComponent<Animator>();

        playerAtkScript = player.GetComponent<PlayerAttacking>();

        damage = -2;
        knockback = 8f;
        stun = 0.5f;
        attackDelay = 0.35f;
        attackHash = Animator.StringToHash("Base Layer.SwordAttack");


    }
Example #14
0
    private void PlayerHit(PlayerAttacking playerAttacking)
    {
        Debug.Log(string.Format("{0} was hit by {1}", this.Player, playerAttacking.Player));

        if (this.IsBlocking && this.Player.Chest != null)
        {
            var blockImpact = GameObject.Instantiate(
                this.BlockImpact,
                this.Player.Chest.transform.position + this.BlockImpact.transform.position,
                Quaternion.identity);

            GameObject.Destroy(blockImpact, this.EFFECT_DURATION);
        }
        else if (this.Player.Chest != null)
        {
            var hitImpact = GameObject.Instantiate(this.HitImpact,
                                                   this.Player.Chest.transform.position + this.HitImpact.transform.position,
                                                   Quaternion.identity);

            GameObject.Destroy(hitImpact, this.EFFECT_DURATION);
        }

        PubSub.Publish(new PlayerHit(this.Player.Id, playerAttacking.AttackType, this.IsBlocking));
    }