コード例 #1
0
ファイル: GPlayer.cs プロジェクト: b1nary0/Shwinn
    // 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;
    }
コード例 #2
0
ファイル: GGun.cs プロジェクト: b1nary0/Shwinn
    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;
        }
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     PlayerActions = GetComponent <GPlayerActions>();
     PlayerScript  = GetComponent <GPlayer>();
 }