Пример #1
0
    public void Throw(int objectID)
    {
        Vector3 handOffset = new Vector3(1, 2, 0);

        handOffset.Scale(transform.localScale);


        Explosive projectile = ObjectRecycler.Singleton.GetObject <Explosive>(objectID);

        projectile.source = this;


        ParabolaMovement projectileMovement = projectile.GetComponent <ParabolaMovement>();

        projectileMovement.targetTime      = 1f;
        projectileMovement.g               = 30;
        projectileMovement.initialPosition = transform.position + handOffset;
        projectileMovement.targetPosition  = currentTarget.transform.position;


        projectile.gameObject.SetActive(true);
    }
Пример #2
0
    public void Shoot(Vector3 direction)
    {
        Explosive explosive = Instantiate(explosivePrefab, firePoint.position, Quaternion.identity);

        explosive.GetComponent <Rigidbody>().AddForce(direction * shootForce);
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     _audio = GetComponent <AudioSource>();
     explosion.GetComponent <SphereCollider>().radius = explosionRadius;
     _playerObject = GameObject.FindGameObjectWithTag("Player");
 }