예제 #1
0
    public void EffectUpdate()
    {
        am = getAM();
        if (am == null)
        {
            return;
        }
        if (am.effectsFolder == null)
        {
            am.effectsFolder = am.gameObject;
        }

        splodes = getAM().effectsFolder.GetComponentsInChildren <HitEffect>(true);

        hitAliases = new string[splodes.Length];

        if (shots.Length == 0)
        {
            hitAliases    = new string[1];
            hitAliases[0] = "No Effects in Effects Folder";
        }

        for (int i = 0; i < splodes.Length; i++)
        {
            hitAliases[i] = splodes[i].getAlias();
        }
    }
예제 #2
0
 void MuzzleBang(Transform Muzzle)
 {
     if (AmmoManager.checkAlias(fireEffectAlias))
     {
         Instantiate(AmmoManager.getHit(fireEffectAlias).gameObject, Muzzle.position, Muzzle.rotation);
     }
 }
예제 #3
0
    public void AmmoUpdate()
    {
        am = getAM();
        if (am == null)
        {
            return;
        }
        if (am.ammoFolder == null)
        {
            am.ammoFolder = am.gameObject;
        }

        shots = getAM().ammoFolder.GetComponentsInChildren <Ammunition>(true);

        ammoAliases = new string[shots.Length];

        if (shots.Length == 0)
        {
            ammoAliases    = new string[1];
            ammoAliases[0] = "No Ammo in Ammo Folder";
        }

        for (int i = 0; i < shots.Length; i++)
        {
            ammoAliases[i] = shots[i].getAlias();
        }
    }
예제 #4
0
    void FixedUpdate()
    {
        float horizontal = Input.GetAxis(horizontalAxis);
        float vertical   = Input.GetAxis(verticalAxis);

        Vector3 direction = new Vector3(horizontal, 0, vertical);

        theBody.AddForce(direction.normalized * maxSpeed);

        theBody.velocity = new Vector3(
            Mathf.Clamp(theBody.velocity.x, -maxSpeed, maxSpeed),
            Mathf.Clamp(theBody.velocity.y, -maxSpeed, maxSpeed),
            Mathf.Clamp(theBody.velocity.z, -maxSpeed, maxSpeed));

        if (mouseLook)
        {
            Vector3 mousePositionInScreen = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0.0f);
            Vector3 mousePositionInWorld  = Camera.main.ScreenToWorldPoint(mousePositionInScreen);
            mousePositionInWorld = new Vector3(mousePositionInWorld.x, 0.0f, mousePositionInWorld.z);
            Vector3 positionToLook = mousePositionInWorld - theTransform.position;

            theTransform.localRotation = Quaternion.LookRotation(positionToLook.normalized, Vector3.up);
        }

        if (Input.GetButtonDown(fireAxis) && canFire)
        {
            foreach (Transform transform in weaponTransforms)
            {
                AmmoManager.SpawnAmmo(transform.position, transform.rotation);
            }
            canFire = false;
            Invoke("EnableFire", reloadDelay);
        }
    }
예제 #5
0
 /* Spawn Ammo/Weapon for Enemy*/
 public void Shoot(bool Enemy)
 {
     foreach (Transform T in transform)
     {
         AmmoManager.SpawnAmmoEnemy(T.position, T.rotation, this);
     }
 }
    // setup everything
    void Start()
    {
        ammoManager = weapon.GetComponent <AmmoManager>();
        ammo        = ammoManager.AmmoCount();
        MaxCount    = ammo;
        Count       = ammo;

        for (int i = 0; i < Count; i++)
        {
            GameObject ThisIndicator = Instantiate(IndicatorGameObject, gameObject.transform.position, Quaternion.Euler(0f, 0f, ((360f / (float)MaxCount) * i))) as GameObject;
            //ThisIndicator.transform.parent = gameObject.transform;
            ThisIndicator.transform.SetParent(gameObject.transform);
            ThisIndicator.transform.localScale = new Vector3(1f, 1f, 1f);

            Images.Add(gameObject.transform.GetChild(i).gameObject.GetComponent <Image>());
        }


        if (CounterClockWise)
        {
            RotateDirection = -1f;
        }
        else
        {
            RotateDirection = 1f;
            Images.Reverse();
        }
    }
예제 #7
0
 private void Start()
 {
     if (GetComponentInParent <AmmoManager>() != null)
     {
         ammoManager = GetComponentInParent <AmmoManager>();
     }
 }
예제 #8
0
 // Update is called once per frame
 void Update()
 {
     //firing turret
     if (Input.GetButtonDown(FireAxis) && CanFire)
     {
         AmmoManager.SpawnAmmo(transform.position, transform.rotation);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.UpArrow) && (AmmoManager.GetAmmoCount() > 0))
     {
         Instantiate(Projectile, FirePoint.position, FirePoint.rotation);
         AmmoManager.AddAmmo(-1);
     }
 }
예제 #10
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.RightControl) && AmmoManager.Ammo > 0)
     {
         AmmoManager.SubtractPoints(PointsToSubtract);
         Instantiate(Projectiles, FirePoint.position, FirePoint.rotation);
     }
 }
예제 #11
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(this);
     }
     instance = this;
 }
예제 #12
0
 // Use this for initialization
 void Start()
 {
     enemyColors    = new List <float>();
     score          = GameObject.FindObjectOfType <Score>();
     enemyCounter   = 0;
     enemiesAllowed = 0;
     AmmoManager.UpdateAmmo(5, 5);
 }
예제 #13
0
 //接口-----------------------------------
 public void Shoot()
 {
     if (!isWorking)
     {
         return;
     }
     AmmoManager.GenerateAmmo(GunPivot.position, transform.up, ammoSpeed, id, tank.campFlag);
 }
예제 #14
0
    //public GameObject ammoPrefab = null;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            AmmoManager.SpawnAmmo(transform.position, transform.rotation);
            //Instantiate(ammoPrefab, transform.position, transform.rotation);
        }
    }
예제 #15
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.LeftControl) && AmmoManager.Ammo > 0)
     {
         AmmoManager.RemovePoints(PointsToRemove);
         Instantiate(Projectile, FirePoint.position, FirePoint.rotation);
     }
 }
예제 #16
0
 // Able to shoot
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.RightControl) && AmmoManager.Ammo > 0)
     {
         Instantiate(Projectile, FirePoint.position, FirePoint.rotation);
         AmmoManager.SubAmmo(1);
     }
 }
예제 #17
0
파일: Shoot.cs 프로젝트: ghavamy/Jangak
 private void Shooting()
 {
     currentDeltaTime += Time.deltaTime;
     if (AmmoManager.instance.magazine > 0 && currentDeltaTime >= timeDelay && Input.GetMouseButtonDown(0))
     {
         AmmoManager.SpawnAmmo(transform.position, transform.rotation);
         currentDeltaTime = 0f;
     }
 }
예제 #18
0
 /// <summary>
 /// Function that instanciate the amunition prefab whenever the player press fire1
 /// </summary>
 private void SpawnAmmo()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         //Instantiate(ammunition, transform.position,transform.rotation);
         //we now go through the ammomanager instead of instanciating ammunition into the scene via this function.
         AmmoManager.SpawnAmmo(transform.position, transform.rotation);
     }
 }
    void OnTriggerEnter2D(Collider2D Other)
    {
        if (Other.GetComponent <Rigidbody2D> () == null)
        {
            return;
        }

        AmmoManager.AddPoints(AmmoToAdd);
    }
예제 #20
0
 private void Awake()
 {
     if (AmmoManagerSingleton != null)
     {
         DestroyImmediate(gameObject);
         return;
     }
     AmmoManagerSingleton = this;
 }
 void Awake()
 {
     if (ammoManagerSingelton != null)
     {
         DestroyImmediate(gameObject);
         return;
     }
     ammoManagerSingelton = this;
 }
예제 #22
0
 void Awake()
 {
     ammo              = 30;
     RemainingAmmo     = 100;
     SystemMesUI       = GameObject.Find("SystemMesUI");
     TimerDisPlay      = SystemMesUI.GetComponent <TimerDisPlay>();
     AmmoManagerObject = GameObject.Find("AmmoManager");
     AmmoManager       = AmmoManagerObject.GetComponent <AmmoManager>();
 }
예제 #23
0
    private void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        GameObject gameOver = GameObject.Find("GameOver Panel");

        score       = GameObject.FindObjectOfType <Score>();
        core        = GameObject.FindObjectOfType <Core>();
        ammoManager = GetComponentInChildren <AmmoManager>();
    }
예제 #24
0
    void Start()
    {
        playMissileClicker2 = FindObjectOfType <PlayerMissileClicker>();
        ammoManager2        = FindObjectOfType <AmmoManager>();

        middleShooter2 = GameObject.FindGameObjectWithTag("MiddlePlayer");
        leftShooter2   = GameObject.FindGameObjectWithTag("LeftPlayer");
        rightShooter2  = GameObject.FindGameObjectWithTag("RightPlayer");
    }
예제 #25
0
 void FixedUpdate()
 {
     if (Input.GetKey(KeyCode.Space) && canFire)
     {
         AudioSource.PlayClipAtPoint(laserAudio, transform.position);
         AmmoManager.SpawnAmmo(transform.position, transform.rotation);
         canFire = false;
         Invoke("EnableFire", reloadDelay);
     }
 }
예제 #26
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <Rigidbody2D>() == null)
        {
            return;
        }
        AmmoManager.AddPoints(PointsToAdd);

        Destroy(gameObject);
    }
예제 #27
0
    private void Awake()
    {
        if (ammoManagerSingleton != null)
        {
            Destroy(this.gameObject);
            return;
        }

        ammoManagerSingleton = this;
    }
예제 #28
0
    void OnTriggerEnter2D(Collider2D Other)
    {
        if (Other.GetComponent <CharacterMove> () == null)
        {
            return;
        }

        AmmoManager.AddAmmo(AmmoToAdd);

        Destroy(gameObject);
    }
예제 #29
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
예제 #30
0
    void OnTriggerEnter2D(Collider2D Other)
    {
        if (Other.GetComponent <CharacterMove> () == null)
        {
            return;
        }
        print("Ammo Value:" + AmmoValue);
        AmmoManager.AddAmmo(AmmoValue);

        Destroy(gameObject);
    }