コード例 #1
0
    private void Awake()
    {
        control       = true;
        rb            = GetComponent <Rigidbody2D>();
        bulletFire    = GetComponent <BulletFire>();
        lastFireBack  = 0;
        lastFireFront = 0;
        lastFireLeft  = 0;
        lastFireRight = 0;
        lastFireMain  = 0;

        L_soft = boundaryDefine.transform.Find("L_Soft");
        L_hard = boundaryDefine.transform.Find("L_Hard");
        R_soft = boundaryDefine.transform.Find("R_Soft");
        R_hard = boundaryDefine.transform.Find("R_Hard");
        D_soft = boundaryDefine.transform.Find("D_Soft");
        D_hard = boundaryDefine.transform.Find("D_Hard");
        U_soft = boundaryDefine.transform.Find("U_Soft");
        U_hard = boundaryDefine.transform.Find("U_Hard");

        backGunHeat = 0;

        lastMainGunReload  = -mainGunReloadTime;
        lastLeftGunReload  = -sideGunReloadTime;
        lastRightGunReload = -sideGunReloadTime;
        lastFrontGunReload = -frontGunReloadTime;

        mainGunMag  = mainGunSlot;
        leftGunMag  = sideGunSlot;
        rightGunMag = sideGunSlot;
        frontGunMag = frontGunSlot;

        lastManualReload = -manualReloadCD;
    }
コード例 #2
0
    private void OnTriggerExit(Collider other)   // if the player tag cartag touches collider, mark it as no longer needed and deactivate
    {
        BulletFire BulletFires = gameObject.GetComponent <BulletFire>();

        CarTag carTag = other.GetComponent <CarTag>();

        if (carTag != null)
        {
            //  if (!exited)
            //   {
            exited = true;
            //     OnFireExited();
            ////    Debug.Log("EXIT");
            ////    Debug.Log("new one");

            StartCoroutine(WaitAndDeactivate());
            /////  OnFireExited();


            // StartCoroutine(WaitAndDeactivate());
            ////   transform.root.gameObject.SetActive(false);

            // }
        }
    }
コード例 #3
0
    private void ShootOfFire()
    {
        //Debug.Log("子弹目标位置:" + posTarget);
        GameObject objBulletFireT = Instantiate(objBulletFire);

        if (objBulletFireT != null)
        {
            Transform tfmBulletFireT = objBulletFireT.transform;
            if (tfmBulletFireT != null)
            {
                tfmBulletFireT.position = transform.position;
            }

            BulletFire bulletFireT = objBulletFireT.GetComponent <BulletFire>();
            if (bulletFireT != null)
            {
            }
            else
            {
                Destroy(objBulletFireT, 0.0f);
            }

            Rigidbody rgBulletFire = objBulletFireT.GetComponent <Rigidbody>();
            if (rgBulletFire != null)
            {
                Vector3 vecForceT = GameInfo.posAimed - tfmMuzzle.position;
                vecForceT = vecForceT.normalized * force;
                rgBulletFire.AddForce(vecForceT);
            }
        }

        timeFireColdNow = timeFireColdMax;
    }
コード例 #4
0
    public void Shoot(Vector3 fromOffset, Vector3 toOffset)
    {
        _animHandler.SetShootAnim();
        var bullet = BulletFire.LaunchBulletFire(gameObject.transform.position + fromOffset,
                                                 _target.transform.position + toOffset) as BulletFire;

        bullet.transform.parent = transform;
    }
コード例 #5
0
 private void Awake()
 {
     player = gameObject;
     //pSight = Camera.main;
     pSight = GetComponentInChildren <Camera>();
     pMover = GetComponent <PlayerMove>();
     rd     = GetComponent <Rigidbody>();
     fire   = transform.GetComponentInChildren <BulletFire>();
 }
コード例 #6
0
    void shoot()
    {
        GameObject bulletGO = (GameObject)Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
        BulletFire bullet   = bulletGO.GetComponent <BulletFire>();

        if (bullet != null)
        {
            bullet.Seek(target);
        }
    }
コード例 #7
0
    protected override void AttackEnemy()
    {
        GameObject bulletFired = (GameObject)Instantiate(bulletPrefab, firePos.position, firePos.rotation);
        BulletFire bullet      = bulletFired.GetComponent <BulletFire>();

        if (bullet != null)
        {
            float[] DoTStats = { base.damage, numberOfTicks, damageInterval };
            bullet.Seek(target, DoTStats);
        }
    }
コード例 #8
0
ファイル: EnemyPolute.cs プロジェクト: hippunk/PlatypusCorp
 // Use this for initialization
 void Start()
 {
     if (target == null)
     {
         target = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <BulletFire> ();
         //Debug.Log ("loaded : " + target);
     }
     else
     {
         Debug.Log("pb chargement Player");
     }
 }
コード例 #9
0
    // firing behaviours
    public static Bullet[] Fire(this BulletFire bf, GameObject prefab, GameObject source)
    {
        switch (bf)
        {
        case BulletFire.Single:
            return(SingleFire(prefab, source));

        case BulletFire.Double:
            return(DoubleFire(prefab, source));

        default:
            return(new Bullet[0]);
        }
    }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     Timepassed = 0;
     Timecheck  = 0;
     Food       = 10;
     Health     = 10;
     healthinc  = false;
     AnimZombie = GetComponent <Animator>();
     Food3.SetActive(false);
     coin             = new Coin();
     bulletfire       = new BulletFire();
     Aidkit           = new FirstAidKit();
     AgentStartingPos = this.transform.position;
 }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     //   OxetocinInHalloForMarko = 0;
     // OxetocinInLaraForMarko = 0;
     coin       = new Coin();
     Timepassed = 0;
     Food       = 10;
     //  PrevFoodForDopamin = 10;
     Health           = 10;
     healthinc        = false;
     AnimZombie       = GetComponent <Animator>();
     Aidkit           = new FirstAidKit();
     bulletfire       = new BulletFire();
     py               = new PythonCommunicator();
     AgentStartingPos = this.transform.position;
 }
コード例 #12
0
    private void OnTriggerEnter(Collider other)
    {
        //should be only bullet
        BulletFire bullet = other.gameObject.GetComponent <BulletFire>();

        if (bullet == null)
        {
            //throw new UnityException("unexpected colliding object");
            return;
        }
        if (bullet.Reflected)
        {
            Debug.Log("ahhhh");
            //hit, maybe fx
            Destroy(bullet.gameObject);
            StartCoroutine(DeathCoroutine());
        }
    }
コード例 #13
0
 // Use this for initialization
 void Start()
 {
     Reward     = 0;
     Timepassed = 0;
     Timecheck  = 0;
     Food       = 10;
     Health     = 10;
     healthinc  = false;
     AnimZombie = GetComponent <Animator>();
     Food3.SetActive(false);
     //Dopamin = 0;
     //OxetocinInHalloForLara = 0;
     //OxetocinInMarkoForLara = 0;
     coin             = new Coin();
     Aidkit           = new FirstAidKit();
     bulletfire       = new BulletFire();
     AgentStartingPos = this.transform.position;
     //  py = new PythonCommunicator();
 }
コード例 #14
0
 /// <summary>
 ///     Gets prefabs and scripts
 /// </summary>
 private void Start()
 {
     createSparks = GetComponent <CreateSparks>();
     _fireScript  = bulletPrefab.GetComponent <BulletFire>();
 }