Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        // Component Gets
        PhysicsBody   = GetComponent <Rigidbody2D>();
        PlayerActions = GetComponent <GPlayerActions>();

        PlayerObjects = GameObject.FindGameObjectsWithTag("Player");

        Weapon = null;

        InitialPosition = gameObject.transform.position;

        bCanBeDamaged = false;

        StartCoroutine(SetAbleToBeDamaged());

        Fatigue = 0;
        Health  = 100;

        AttackFatigueAmt = 4.0f;
        AttackDamageAmt  = 4.0f;
    }
Ejemplo n.º 2
0
    public void Fire()
    {
        Debug.Log("Prefire");
        FireInterval += Time.deltaTime;

        Debug.Log(FireInterval);

        if (FireInterval >= FireRate)
        {
            Debug.Log("Firing");
            GameObject Bullet       = Instantiate <GameObject>(Resources.Load("Prefabs/Gameplay/Weapons/Bullet") as GameObject);
            GBullet    BulletScript = Bullet.GetComponent <GBullet>();

            Bullet.transform.position = transform.position;

            GPlayerActions PlayerAction = Owner.GetComponent <GPlayerActions>();
            BulletScript.SetDirection((PlayerAction.bFacingRight) ? new Vector2(1, 0) : new Vector2(-1, 0));

            Physics2D.IgnoreCollision(Bullet.GetComponent <Collider2D>(), Owner.GetComponent <Collider2D>());

            FireInterval = 0;
        }
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     PlayerActions = GetComponent <GPlayerActions>();
     PlayerScript  = GetComponent <GPlayer>();
 }