Inheritance: MonoBehaviour
Beispiel #1
0
    //private bool isGrounded;

    void Start()
    {
        player       = GameObject.FindGameObjectWithTag("Player");
        playerAttack = player.GetComponent <playerAttack>();
        //heartTransform = GetComponent<Transform>();
        heartRB = GetComponent <Rigidbody2D>();
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     redPots      = 2;
     redNum       = GameObject.Find("redNum").GetComponent <Text>();
     playerHealth = GameObject.Find("Player").GetComponent <playerHealth>();
     playerAttack = GameObject.Find("trigger").GetComponent <playerAttack> ();
 }
Beispiel #3
0
 void Start()
 {
     player           = GameObject.FindGameObjectWithTag("Player");
     playerController = player.GetComponent <playerController>();
     playerAttack     = player.GetComponent <playerAttack>();
     StartCoroutine(Timer());
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        ps = GameObject.FindGameObjectWithTag("Player").GetComponent <playerstatus> ();
        pa = GameObject.FindGameObjectWithTag("Player").GetComponent <playerAttack> ();

        //setInfo ();
    }
 void Start()
 {
     gameController       = GameObject.Find("UI").GetComponent <GameController>();
     player               = GameObject.FindGameObjectWithTag("Player");
     playerAttack         = player.GetComponent <playerAttack>();
     groundEnemyTransform = GetComponent <Transform>();
     groundEnemyRB        = GetComponent <Rigidbody2D>();
 }
 // Start is called before the first frame update
 void Start()
 {
     playerGroundedCheck = GetComponentInChildren <PlayerGroundedCheck>();
     playerTransform     = GetComponent <Transform>();
     player         = GetComponent <Rigidbody2D>();
     playerCollider = GetComponent <CapsuleCollider2D>();
     playerAttack   = GetComponent <playerAttack>();
 }
Beispiel #7
0
    void Start()
    {
        character      = GetComponent <CharacterController>();
        playerAttack   = GetComponent <playerAttack>();
        targetPosition = transform.position;

        //tag = "no tag selected";
    }
Beispiel #8
0
 // Start is called before the first frame update
 void Start()
 {
     player               = GameObject.FindGameObjectWithTag("Player");
     playerAttack         = player.GetComponent <playerAttack>();
     flyingEnemyTransform = GetComponent <Transform>();
     flyingEnemy          = GetComponent <Rigidbody2D>();
     facing               = flyingEnemyTransform.localScale.x;
 }
Beispiel #9
0
    void Start()
    {
        playerScale      = transform.localScale;
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;

        myAttack = GetComponentInChildren <playerAttack>();
    }
	playerAttack pa;									// Player Attack script
	// Use this for initialization
	void Start () {
		//get player animator
		Animator anim;	
		//Get players movement script
		pc = GetComponent<PlayerControl> ();
		//Get players attack script
		pa = transform.FindChild("weapon").GetComponent<playerAttack> ();
	}
 void Start()
 {
     gameController = GameObject.Find("UI").GetComponentInChildren <GameController>();
     player         = GameObject.FindGameObjectWithTag("Player");
     playerAttack   = player.GetComponent <playerAttack>();
     //heartTransform = GetComponent<Transform>();
     daggerPickUpRB = GetComponent <Rigidbody2D>();
 }
Beispiel #12
0
    //public GameController gameController;

    // Start is called before the first frame update
    void Start()
    {
        //gameController = GameObject.Find("UI").GetComponentInChildren<GameController>();
        player          = GameObject.FindGameObjectWithTag("Player");
        playerAttack    = player.GetComponent <playerAttack>();
        secretRB        = GetComponent <Rigidbody2D>();
        secretTransform = GetComponent <Transform>();
    }
 // Start is called before the first frame update
 void Start()
 {
     gameController       = GameObject.Find("UI").GetComponentInChildren <GameController>();
     player               = GameObject.FindGameObjectWithTag("Player");
     playerAttack         = player.GetComponent <playerAttack>();
     flyingEnemyTransform = GetComponent <Transform>();
     flyingEnemy          = GetComponent <Rigidbody2D>();
     facing               = flyingEnemyTransform.localScale.x;
 }
Beispiel #14
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.transform.tag == "Player")
     {
         print("Hello");
         playerAttack attack = collider.transform.GetComponent <playerAttack>();
         attack.weapond = newWeapond;
         Destroy(gameObject);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     playerGroundedCheck = GetComponentInChildren <PlayerGroundedCheck>();
     playerTransform     = GetComponent <Transform>();
     player         = GetComponent <Rigidbody2D>();
     playerCollider = GetComponent <CapsuleCollider2D>();
     playerAttack   = GetComponent <playerAttack>();
     UI             = FindObjectOfType <Canvas>();
     healthBar      = UI.GetComponentInChildren <PlayerHealthBar>();
 }
    void Awake()
    {
        _instance = this;

        ps        = this.GetComponent <playerstatus>();
        animation = GetComponent <Animation> ();
        normal    = body.GetComponent <Renderer> ().material.color;
        pa        = this.GetComponent <playerAnimation> ();
        foreach (GameObject go in efxArray)
        {
            efxDict.Add(go.name, go);
        }
    }
Beispiel #17
0
    void CheckSkill()
    {
        if (status.IsAttacked | status.IsAttack | status.IsDead)
        {
            return;
        }
        if (Time.time - status.LastSkillTime > status.skillRestTime | Time.time < status.skillRestTime)
        {
            skillInfo       = attack.GetSkillInfo((int)status.FaceTo);
            status.SkillDir = status.LastDir;
            if (Input.GetButton("Fire2") && !status.IsSkill && status.CurBlue > status.SkillBlue)
            {
                status.IsSkill       = true;
                status.LastSkillTime = Time.time;
                fireball             = Instantiate(Resources.Load("player/playerSkill", typeof(playerAttack))) as playerAttack;
                fireball.Pstatus     = status;
                //fireball.transform.SetParent(this.transform);
                //Vector2 skillPos = collider.ClosestPoint((Vector2)(target.position));
                fireball.GetComponent <Transform>().position = tranform.position + skillInfo.pos;
                fireball.GetComponent <Transform>().rotation = skillInfo.qua;
                Destroy(fireball.gameObject, status.skillHoldTime);

                status.UpdateBlue(-status.SkillBlue);
            }
            else
            {
                status.IsSkill = false;
            }
        }


        //进行攻击动作
        animator.SetBool("is_skill", status.IsSkill);
        if (status.IsSkill)
        {
            //rigidbody2d.velocity +
            fireball.GetComponent <Rigidbody2D>().velocity = skillInfo.speed * (Vector2)status.SkillDir;
            if (!audio.isPlaying)
            {
                audio.PlayOneShot((int)Time.time % 2 == 0 ? skill1 : skill2);
            }
            //Debug.LogFormat("fireball velocity {0}", fireball.GetComponent<Rigidbody2D>().velocity);
        }
        else
        {
            if (fireball)
            {
                Destroy(fireball.gameObject, 0.3f);
            }
        }
    }
Beispiel #18
0
    // Start is called before the first frame update
    void Start()
    {
        player       = GameObject.FindGameObjectWithTag("Player");
        playerAttack = player.GetComponent <playerAttack>();
        axe          = GetComponent <Rigidbody2D>();
        facing       = player.transform.localScale.x;

        if (facing > 0)
        {
            axe.AddForce(new Vector2(2f, throwForce), ForceMode2D.Impulse);
        }
        else if (facing < 0)
        {
            axe.AddForce(new Vector2(-2f, throwForce), ForceMode2D.Impulse);
        }
    }
Beispiel #19
0
    // Start is called before the first frame update
    void Start()
    {
        daggerTransform          = GetComponent <Transform>();
        player                   = GameObject.FindGameObjectWithTag("Player");
        facing                   = player.transform.localScale.x;
        playerAttack             = player.GetComponent <playerAttack>();
        playerRigidbody          = player.GetComponent <Rigidbody2D>();
        attackPoint              = player.transform.Find("subAttackPoint");
        daggerTransform.position = attackPoint.position;

        if (facing > 0)
        {
            targetPoint = new Vector3((daggerTransform.position.x + 50f), daggerTransform.position.y, 0);
        }
        else if (facing < 0)
        {
            targetPoint = new Vector3((daggerTransform.position.x - 50f), daggerTransform.position.y, 0);
        }
    }
Beispiel #20
0
    // Start is called before the first frame update
    void Start()
    {
        crossTransform          = GetComponent <Transform>();
        player                  = GameObject.FindGameObjectWithTag("Player");
        facing                  = player.transform.localScale.x;
        playerAttack            = player.GetComponent <playerAttack>();
        playerRigidbody         = player.GetComponent <Rigidbody2D>();
        attackPoint             = player.transform.Find("subAttackPoint");
        crossTransform.position = attackPoint.position;
        startPoint              = attackPoint.position;

        if (facing > 0)
        {
            targetPoint    = new Vector3((crossTransform.position.x + range), crossTransform.position.y, 0);
            throwDirection = 1;
        }
        else if (facing < 0)
        {
            targetPoint    = new Vector3((crossTransform.position.x - range), crossTransform.position.y, 0);
            throwDirection = -1;
        }
    }
    void Start()
    {
        playerSprite        = GetComponent <SpriteRenderer>();
        playerGroundedCheck = GetComponentInChildren <PlayerGroundedCheck>();
        playerTransform     = GetComponent <Transform>();
        player         = GetComponent <Rigidbody2D>();
        playerCollider = GetComponent <CapsuleCollider2D>();
        playerAttack   = GetComponent <playerAttack>();
        UI             = FindObjectOfType <Canvas>();
        //healthBar = UI.GetComponentInChildren<PlayerHealthBar>();
        primaryAttackPoint = transform.Find("primaryAttackPoint");
        subAttackPoint     = transform.Find("subAttackPoint");
        playerAnimator     = GetComponent <Animator>();

        /*playerHealth = 16;
         * playerFacing = 1;
         * isInvulnerable = false;
         * invulnerableDuration = 3;
         * jumpForce = 7.5f;
         * isHit = false;
         * isDead = false;
         * speed = 5f;
         * nearStairs = false;
         * onStairs = false;
         * goingUp = false;
         * goingDown = false;
         * stairsStartPoint = Vector2.zero;
         * stairsEndPoint = Vector2.zero;
         * nearbyStairs = null;
         * stairsInfo = null;
         * stairsFacing = 0;
         * stairsSlope = 0;
         * maxVelocity = 5f;
         * stepRate = 4f;
         */
    }
Beispiel #22
0
 private void Start()
 {
     playerAtt = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <playerAttack>();
 }
Beispiel #23
0
 void Start()
 {
     attackController = gameObject.GetComponent <playerAttack>();
 }
 // Use this for initialization
 void Start()
 {
     ps        = GetComponent <playerstatus> ();
     animation = GetComponent <Animation>();
     attack    = GetComponent <playerAttack> ();
 }