//===================================================================== #region Protected methods //===================================================================== /// <summary> /// Sources and initializes component variables. /// </summary> /// <param name="weapon"> /// The weapon script that fired this GameObject. /// </param> /// <param name="attacker"> /// The GameObject initiating the attack/heal. /// </param> protected void InitVars(IBulletDWGO weapon, GameObject attacker) { base.InitVars(weapon, attacker); // Initialize weapon-housed projectile variables this.LayerMask = weapon.LayerMask; this.MaxRaycastDistance = weapon.MaxRaycastDistance; this.RaycastRefreshSeconds = weapon.RaycastRefreshSeconds; this.RicochetCount = weapon.RicochetCount; }
//===================================================================== #region Public methods //===================================================================== /// <summary> /// Initializes the DWGO variables, sets the appropraite rotation, launches /// the GameObject in its "forward" direction, starts the self destruct /// countdown. Starts raycasting if the DWGO is set to richochet. /// </summary> /// <param name="weapon"> /// The weapon script that fired this GameObject. /// </param> /// <param name="attacker"> /// The GameObject initiating the attack/heal. /// </param> /// <param name="direction"> /// The direction that the attack is to be made. /// </param> public void Init(IBulletDWGO weapon, GameObject attacker, Vector3 direction) { InitVars(weapon, attacker); transform.eulerAngles = new Vector3(0, base.GetAngleFromVectorFloat(direction), 0); StartCoroutine(base.StartSelfDestructCountdown()); LaunchForward(); if (this.RicochetCount > 0) { InvokeRepeating("UpdateReflectionInfo", 0f, this.RaycastRefreshSeconds); } }