//===================================================================== #region Public methods //===================================================================== /// <summary> /// Initializes the DWGO variables, sets the appropraite rotation, /// launches the GameObject as desired, starts the self destruct countdown. /// </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 virtual void Init(IDynamicWGO weapon, GameObject attacker, Vector3 direction) { InitVars(weapon, attacker); transform.eulerAngles = new Vector3(0, GetAngleFromVectorFloat(direction), 0); StartCoroutine(StartSelfDestructCountdown()); // Fill in: Move object in some way... }
/// <summary> /// Sources and initializes component variables. /// </summary> protected virtual void InitVars(IDynamicWGO weapon, GameObject attacker) { // Initialize IWarAndPeace variables this.Attacker = attacker; this.CriticalHitMultiplier = weapon.CriticalHitMultiplier; this.CriticalHitChance = weapon.CriticalHitChance; this.IsFriendlyFire = weapon.IsFriendlyFire; this.IsHeal = weapon.IsHeal; this.KnockbackMagnitude = weapon.KnockbackMagnitude; this.KnockbackableMagnitude = weapon.KnockbackableMagnitude; this.KnockbackOrigin = this.gameObject; this.MaximumDamage = weapon.MaximumDamage; this.MinimumDamage = weapon.MinimumDamage; this.Title = weapon.Title; // Initialize IDynamicGameObject variables this.MoveSpeed = weapon.MoveSpeed; this.SelfDestructSeconds = weapon.SelfDestructSeconds; this.SpawnOffsetDistance = weapon.SpawnOffsetDistance; // Initialize ADynamicGameObject variables rigidbody = GetComponent <Rigidbody>(); }