Example #1
0
        // ----------
        // MonoBehaviour methods
        // ----------
        void Start()
        {
            this.trailCaster = this.GetComponent<TrailCaster>();

            if(this.trailCaster == null)
            {
                this.trailCaster = this.GetComponentInChildren<TrailCaster>();
            }

            if(this.trailCaster == null)
            {
                DebugTool.LogWarning("Melee weapons need a TrailCaster component either attached directly or to a child GameObject");
            }
            else
            {
                this.trailCaster.AddHitCallback(this.OnHit);
            }
        }
Example #2
0
        // TODO: Explosions (radial definition) and decals
        /**
         * Init
         */
        public void Init()
        {
            this.trailCaster = this.GetComponent<TrailCaster>();
            this.trailCaster.AddHitCallback(OnHit);

            this.trailCaster.Ignore(this.weapon.wielder.gameObject);
            this.trailCaster.Ignore(this.weapon.gameObject);
            this.trailCaster.Ignore(this.gameObject);

            Collider weaponCollider = this.weapon.gameObject.GetComponent<Collider>();
            Collider thisCollider = this.GetComponent<Collider>();

            if(weaponCollider != null && thisCollider != null)
            {
                Physics.IgnoreCollision(thisCollider, weaponCollider, true);
            }

            this.isLive = true;
        }