예제 #1
0
    public void Fire(Vector2 direction, Vector2 baseVelocity)
    {
        Instantiate(Burst, transform.position, transform.rotation, transform.parent);
        ShotController shot = Instantiate(Shot, transform.position, transform.rotation, transform.parent).GetComponent <ShotController>();

        shot.WorldController = WorldController;
        shot.Fire(direction, baseVelocity, Damage);
    }
예제 #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Shot"))
     {
         ShotController sc = other.GetComponent <ShotController>();
         sc.Stop();
         GetComponentInParent <FirstBossController>().AddDestroyed();
         Destroy(gameObject);
     }
 }
예제 #3
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        _gameVariables  = GameVariables.Instance;
        _shotController = ShotController.Instance;
    }
예제 #4
0
 private void Start()
 {
     _player             = GameObject.FindGameObjectWithTag("Player");
     _shotController     = GetComponent <ShotController>();
     _navMeshAgent       = GetComponent <NavMeshAgent>();
     _squarVisionRange   = _visionRange * _visionRange;
     _squarAttackRange   = _attackRange * _attackRange;
     _currentPatrolPoint = 0;
     _targetPosition     = Vector3.zero;
 }
예제 #5
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Shot"))
     {
         ShotController sc = other.GetComponent <ShotController>();
         if (ElementsUtils.elementMatch(sc.element, element))
         {
             Damage();
         }
         sc.Stop();
     }
 }
예제 #6
0
    void OnTriggerEnter(Collider other)
    {
        if (isDead)
        {
            return;
        }

        if (other.tag == "Player")
        {
            player = other.GetComponent <PlayerHealth>();

            player.TakeDamage(30);

            Death();
        }
        else if (other.tag == "Bullet")
        {
            Debug.Log("Ouch");

            shot = other.GetComponent <ShotController>();

            Debug.Log(shot.Element());

            if (shot.Element() == "Fire")
            {
                amount = fireDmg;
            }
            if (shot.Element() == "Water")
            {
                amount = waterDmg;
            }
            if (shot.Element() == "Air")
            {
                amount = airDmg;
            }
            if (shot.Element() == "Earth")
            {
                amount = earthDmg;
            }

            currentHealth -= amount;

            Destroy(other.gameObject);
        }



        if (currentHealth <= 0 && !isDead)
        {
            Death();
        }
    }
    private void Fire()
    {
        float          x              = shotSpawn.transform.position.x;
        float          y              = shotSpawn.transform.position.y;
        float          z              = shotSpawn.transform.position.z;
        GameObject     Shot           = Instantiate(shotPrefab, new Vector3(x, y, z), new Quaternion(0, 0, shotDirectionDegrees, 0)) as GameObject;
        ShotController shotContGetter = Shot.GetComponent <ShotController>();

        shotContGetter.GetShotStats(shotSpeed, shotKillTime, shotExpansionMultiplier, shotDam);
        Vector3 rotA = Shot.transform.position;

        rotA.z = shotDirectionDegrees;
        Shot.transform.Rotate(rotA);
    }
예제 #8
0
    public void shoot()
    {
        GameObject prefab = (GameObject)Resources.Load("Prefabs/Shot", typeof(GameObject));
        GameObject shot   = Instantiate(prefab);
        //shot.transform.parent = this.gameObject.transform;
        ShotController controller = shot.GetComponent <ShotController>();
        Quaternion     rotation   = this.transform.rotation;
        Vector2        location   = this.frontOfSprite();

        controller.shoot(location, rotation);
        if (this.animator != null && this.animator.HasState(0, Animator.StringToHash("shot_fx")))
        {
            this.animator.Play("shot_fx");
        }
    }
예제 #9
0
    private void Shoot()
    {
        Transform rightTransform = transform.GetChild(0);
        Transform leftTransform  = transform.GetChild(1);

        GameObject rightProjectile =
            Instantiate(projectile, rightTransform.position, Quaternion.identity);
        GameObject leftProjectile =
            Instantiate(projectile, leftTransform.position, Quaternion.identity);

        ShotController leftController  = rightProjectile.GetComponent <ShotController>();
        ShotController rightController = leftProjectile.GetComponent <ShotController>();

        leftController.Launch();
        rightController.Launch();
    }
        public void ReproduceOnlinePlayerShot(ShotInfo shot)
        {
            if (shot != null)
            {
                PrintShotInfo(shot);
                GameBoard.ReproduceConstructedShot(shot, false, false);

                DebugLog.DebugMessage("Launch Send Shot in API", true);
                //ShotController.LaunchPostNewShot(shot);
                //ShotController.LaunchTaskPostNewShot(shot);
            }
            else
            {
                ShotController.LaunchGetOneShot(BattleInformation.OnlineGameInfo.id_game, BattleInformation.ShotCount);
            }
        }
예제 #11
0
    public void Shooting(int shotNum)
    { //샷 생성
        if (myWeaponType == (int)eWEAPON.em_BOW)
        {
            nowShot = arrow[shotNum];
        }
        else if (myWeaponType == (int)eWEAPON.em_WAND)
        {
            nowShot = magic[shotNum];
        }
        nowShot.transform.position = transform.position;
        ShotController shotCntrl = nowShot.GetComponentInChildren <ShotController>();

        nowShot.transform.GetChild(0).eulerAngles = GetComponentInParent <Transform>().eulerAngles;
        shotCntrl.enabled  = true;
        shotCntrl.rayPoint = ray.direction * 10;
    }
예제 #12
0
        public void GetTaskDetailsbySearchArgsNoZIPCode()
        {
            string search = "";

            // Arrange
            ShotController controller = new ShotController();
            // Act
            Task <ActionResult> result = controller.FilterIndex(search) as Task <ActionResult>;
            // Assert

            ActionResult myActResult = result.Result;

            var model = ModelFromActionResult <List <StoresViewModel> >(myActResult);

            //Assert.IsTrue((model.errors.message ?? "").Contains("Exists"));

            Assert.IsTrue((model.errors.message ?? "").Contains("Zipcode must contain a value."));
        }
    private void OnCollisionEnter(Collision other)
    {
        ShotController shotCollider = other.gameObject.GetComponent <ShotController>();

        if (shotCollider != null)
        {
            ValidateColliders(
                other.gameObject.tag,
                shotCollider.ShooterName
                );
        }
        else
        {
            ValidateColliders(
                other.gameObject.tag,
                ""
                );
        }
    }
예제 #14
0
    void FixedUpdate()
    {
        if (VisibleObject.IsVisible && Player)
        {
            RotateTowardsPlayer(Time.deltaTime);

            transform.position += new Vector3(Random.Range(-5f, 5f), Random.Range(-5f, 5f), 0) * Time.deltaTime;

            ShotCooldown -= Time.deltaTime;
            if (ShotCooldown <= 0)
            {
                Instantiate(Burst, LookAhead.transform.position, transform.rotation, transform.parent);
                Vector2        direction = Vector2Utils.Vector2FromAngle(Body.rotation + Random.Range(-15f, 15f));
                ShotController shot      = Instantiate(Shot, LookAhead.transform.position, transform.rotation, transform.parent).GetComponent <ShotController>();
                shot.Fire(direction, Body.velocity, ShootPower);

                ShotCooldown = MaxShootCooldown + Random.Range(-0.15f, 0.15f);
            }
        }
    }
예제 #15
0
    private void activateBuddy()
    {
        if (buddyReference == null)
        {
            buddyReference = Instantiate(player, player.transform.position + (new Vector3(0, 0, 50)), Quaternion.identity);
            buddyReference.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
            Destroy(buddyReference.GetComponent <PlayerController>());
            Destroy(buddyReference.GetComponent <GestureInputController>());
            BuddyController buddyController = buddyReference.AddComponent <BuddyController>();

            ShotController shotController = buddyReference.GetComponent <ShotController>();
            buddyController.shotController = shotController;
            //shotController.shot.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);

            buddyController.GetComponent <DestroyController>().health = ITEM_BUDDY_HEALTH;

            OrbitantMovement orbitantMovement = buddyReference.AddComponent <OrbitantMovement>();
            orbitantMovement.center            = player.transform;
            orbitantMovement.destroyController = buddyReference.GetComponent <DestroyController>();
        }
    }
예제 #16
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        ShotDictionary = new Dictionary <string, Queue <GameObject> >();

        foreach (var shot in Shots)
        {
            var shotPool = new Queue <GameObject>();

            for (var i = 0; i < shot.Size; i++)
            {
                var newShot = Instantiate(shot.Prefab);
                newShot.SetActive(false);
                shotPool.Enqueue(newShot);
            }

            ShotDictionary.Add(shot.Type, shotPool);
        }
    }
예제 #17
0
    private BankType IsBankShot(Player p)
    {
        if (m_type == ShotType.LAYUP && ShotController.GetShotRange(m_type) == ShotRange.CLOSE)
        {
            if (p.isDribLeft)
            {
                return(BankType.LEFT);
            }
            else if (p.isDribRight)
            {
                return(BankType.RIGHT);
            }
            else
            {
                return(GetClosestBank(p.transform.position));
            }
        }
        else if (m_type == ShotType.SHOT && p.isCtrlDown)
        {
            return(GetClosestBank(p.transform.position));
        }

        return(BankType.NONE);
    }
예제 #18
0
 void Awake()
 {
     instance = this;
 }
예제 #19
0
 // Use this for initialization
 private void Start()
 {
     controller = GetComponent <ShotController>();
     OnSpecialEnd();
 }
 public void SendCurrentPlayerShot(ShotInfo shot)
 {
     DebugLog.DebugMessage("Launch Send Shot in API", true);
     ShotController.LaunchPostNewShot(shot);
     //ShotController.LaunchTaskPostNewShot(shot);
 }
예제 #21
0
 private void Start()
 {
     _player         = GameObject.FindGameObjectWithTag("Player");
     _shotController = GetComponent <ShotController>();
 }
 //Method called by BattleManager, to launch research of a shot of the online player.
 public void WaitOtherPlayerShot()
 {
     ShotController.LaunchGetOneShot(BattleInformation.OnlineGameInfo.id_game, BattleInformation.ShotCount);
 }
예제 #23
0
 void Start()
 {
     controller = GetComponent <CatController> ();
     shot       = GetComponent <ShotController> ();
 }
예제 #24
0
 public void SetShotCtrl(ShotController shotCtrl)
 {
     _shotCtrl = shotCtrl;
 }
예제 #25
0
 void Awake()
 {
     cd = GetComponent<Collider2D>();
     sc = GetComponent<ShotController>();
 }
예제 #26
0
 void Start()
 {
     shotController = GetComponent <ShotController>();
     nextFire       = Time.time + initialWait;
 }
예제 #27
0
 private void Start()
 {
     shotController = gameObject.GetComponent <ShotController>();
 }
예제 #28
0
 void Awake()
 {
     shotController = GetComponent <ShotController>();
     nextFire       = Time.time + initialWait;
     currBurst      = 0;
 }
예제 #29
0
 void Awake()
 {
     instance = this;
 }
예제 #30
0
 private void Start()
 {
     _currentShotController = _shotControllers[0];
 }
예제 #31
0
    // =================================== MonoBehaviour Functions ===================================

    void Start()
    {
        Singleton        = this;
        m_shotController = GetComponent <ShotController>();
    }
예제 #32
0
 // Use this for initialization
 private void Start()
 {
     controller = GetComponent<ShotController>();
     OnSpecialEnd();
 }