Exemplo n.º 1
0
        void Update()
        {
            bool hitOthers = false;
            //check if missile is within a tank's collider
            Tank oppTank = Match.instance.GetOppositeTank(Team);

            if (oppTank != null && oppTank.IsDead == false)
            {
                if (oppTank.IsInFireCollider(Position))
                {
                    hitOthers = true;
                    oppTank.TakeDamage(m_Owner);
                    Utils.PlayParticle("CFX3_Hit_SmokePuff", Position);
                    Match.instance.RemoveMissile(this);
                }
            }
            Vector3 newPos = Position + m_InitVelocity * Time.deltaTime;

            if (hitOthers == false)
            {
                //check if missile will hit some collider
                RaycastHit hitInfo;
                if (Physics.Linecast(Position, newPos, out hitInfo, PhysicsUtils.LayerMaskCollsion))
                {
                    bool hitOwner = false;
                    if (PhysicsUtils.IsFireCollider(hitInfo.collider))
                    {
                        //hit player
                        FireCollider fc = hitInfo.collider.GetComponent <FireCollider>();
                        if (fc != null && fc.Owner != null)
                        {
                            if (fc.Owner.Team != Team)
                            {
                                fc.Owner.TakeDamage(m_Owner);
                            }
                            else
                            {
                                hitOwner = true;
                            }
                        }
                        Utils.PlayParticle("CFX3_Hit_SmokePuff", hitInfo.point);
                    }
                    else
                    {
                        Utils.PlayParticle("CFX3_Hit_SmokePuff_Wall", hitInfo.point);
                    }
                    if (hitOwner == false)
                    {
                        Match.instance.RemoveMissile(this);
                        hitOthers = true;
                    }
                }
            }
            if (hitOthers == false)
            {
                transform.position = newPos;
            }
        }
Exemplo n.º 2
0
        public bool CanSeeOthers(Vector3 pos)
        {
            bool       seeOthers = false;
            RaycastHit hitInfo;

            if (Physics.Linecast(FirePos, pos, out hitInfo, PhysicsUtils.LayerMaskCollsion))
            {
                if (PhysicsUtils.IsFireCollider(hitInfo.collider))
                {
                    seeOthers = true;
                }
            }
            return(seeOthers);
        }
Exemplo n.º 3
0
        void OnTriggerEnter(Collider other)
        {
            if (PhysicsUtils.IsFireCollider(other) == false)
            {
                return;
            }
            if (m_Taken == true)
            {
                return;
            }
            m_Taken = true;
            FireCollider fc = other.GetComponent <FireCollider>();

            if (fc != null && fc.Owner != null)
            {
                fc.Owner.TakeStar(m_IsSuperStar);
                Match.instance.SendStim(
                    Stimulus.CreateStimulus((int)EStimulusType.StarTaken, ESensorType.Hearing, Position, this));
                Match.instance.RemoveStar(this);
            }
        }
Exemplo n.º 4
0
        void Update()
        {
            Vector3    newPos = Position + m_InitVelocity * Time.deltaTime;
            RaycastHit hitInfo;

            if (Physics.Linecast(Position, newPos, out hitInfo, PhysicsUtils.LayerMaskCollsion))
            {
                bool hitOwner = false;
                if (PhysicsUtils.IsFireCollider(hitInfo.collider))
                {
                    //hit player
                    FireCollider fc = hitInfo.collider.GetComponent <FireCollider>();
                    if (fc != null && fc.Owner != null)
                    {
                        if (fc.Owner.Team != Team)
                        {
                            fc.Owner.TakeDamage(m_Owner);
                        }
                        else
                        {
                            hitOwner = true;
                        }
                    }
                    Utils.PlayParticle("CFX3_Hit_SmokePuff", Position);
                }
                else
                {
                    Utils.PlayParticle("CFX3_Hit_SmokePuff_Wall", Position);
                }
                if (hitOwner == false)
                {
                    Match.instance.RemoveMissile(this);
                }
            }
            else
            {
                transform.position = newPos;
            }
        }