public virtual void Init(Observer observer) { Manager.Add(this); this.Observer = observer; observer.Data.UpdateHealth(Health); rigidbody = GetComponent <Rigidbody>(); Variants = Dependancy.Get <PlayerVariants>(gameObject); Movement = Dependancy.Get <PlayerMovement>(gameObject); Body = Dependancy.Get <PlayerBody>(gameObject); Aim = Dependancy.Get <PlayerAim>(gameObject); Weapons = Dependancy.Get <PlayerWeapons>(gameObject); Score = Dependancy.Get <PlayerScore>(gameObject); References.Init(this); Variants.Init(this); Ragdoll = Dependancy.Get <RagdollController>(gameObject); Ragdoll.Disable(); Health.OnValueChanged += OnHealthChanged; }
protected virtual void Awake() { rigidbodies = Dependancy.GetAll <Rigidbody>(gameObject); colliders = Dependancy.GetAll <Collider>(gameObject); Disable(); }
protected virtual void UpdateModules(float value) { var dependancies = Dependancy.GetAll <Module>(gameObject); foreach (var dependancy in dependancies) { dependancy.OnValueChanged(value); } }
public override void Execute() { if (audioSource == null) { throw Dependancy.FormatException(nameof(audioSource), this); } StartCoroutine(Procedure()); }
public virtual void Configure() { transition = Dependancy.Get <UITransition>(gameObject, Dependancy.Scope.RecursiveToParents); if (transition == null) { throw new NullReferenceException("Cannot find UI Transition for module: " + name + " to use"); } }
public override void Execute() { if (target == null) { throw Dependancy.FormatException(nameof(target), this); } target.Show(); }
public static void Apply(GameObject gameObject) { foreach (var renderer in Dependancy.GetAll <Renderer>(gameObject)) { if (renderer.shadowCastingMode == ShadowCastingMode.On) { renderer.shadowCastingMode = ShadowCastingMode.TwoSided; } } }
public static void Do(GameObject gameobject1, GameObject gameobject2) { var colliders1 = Dependancy.GetAll <Collider>(gameobject1); var colliders2 = Dependancy.GetAll <Collider>(gameobject2); for (int x = 0; x < colliders1.Count; x++) { for (int y = 0; y < colliders2.Count; y++) { Physics.IgnoreCollision(colliders1[x], colliders2[y], true); } } }
protected override void Start() { base.Start(); Body = Dependancy.Get <ZombieBody>(gameObject); Agent = GetComponent <NavMeshAgent>(); Animator = Dependancy.Get <Animator>(gameObject); Animator.SetFloat("Cycle Offset", Random.value); TriggersRewind = Dependancy.Get <AnimationTriggersRewind>(gameObject); TriggersRewind.Add(AttackConnected, "Attack Connected"); Ragdoll = Dependancy.Get <RagdollController>(gameObject); Ragdoll.Disable(); StartCoroutine(Procedure()); }
protected virtual void Reset() { var sizeFitter = Dependancy.Get <ContentSizeFitter>(gameObject); if (sizeFitter != null) { panel = sizeFitter.transform as RectTransform; if (sizeFitter.verticalFit == ContentSizeFitter.FitMode.PreferredSize) { axis = AxisTarget.Y; } else if (sizeFitter.horizontalFit == ContentSizeFitter.FitMode.PreferredSize) { axis = AxisTarget.X; } MaxSize = PanelSize; } }
public override void Execute() { if (current == null) { Debug.LogWarning(Dependancy.FormatExceptionText(nameof(current), this)); } else { current.Hide(); } if (target == null) { Debug.LogWarning(Dependancy.FormatExceptionText(nameof(target), this)); } else { target.Show(); } }
public override void Execute() { if (audioSource == null) { throw Dependancy.FormatException(nameof(audioSource), this); } if (clip == null) { throw Dependancy.FormatException(nameof(clip), this); } switch (playMode) { case PlaybackMode.Loop: if (audioSource.isPlaying) { audioSource.Stop(); } audioSource.clip = clip; audioSource.loop = true; audioSource.Play(); break; case PlaybackMode.OverridingOneShot: case PlaybackMode.AdditiveOneShot: if (playMode == PlaybackMode.OverridingOneShot && audioSource.isPlaying) { audioSource.Stop(); } audioSource.PlayOneShot(clip); break; default: throw new NotImplementedException(); } }
protected virtual void GetDependancies() { Bar = Dependancy.Get <ProgressBar>(gameObject, Dependancy.Scope.RecursiveToParents); }
protected virtual void Reset() { audioSource = Dependancy.Get <AudioSource>(gameObject); }
protected virtual void Reset() { target = Dependancy.Get <UIElement>(gameObject, Dependancy.Scope.RecursiveToParents); }
public void Init(Entity reference) { Entity = reference; Animator = Dependancy.Get <Animator>(Entity.gameObject); }
public virtual void Init() { ConstraintArea = Dependancy.Get <ConstraintArea>(gameObject); List = new List <Player>(); }
public void Init(Player reference) { this.player = reference; Sprint = Dependancy.Get <PlayerSprint>(player.gameObject); }
protected virtual void Awake() { Health = GetComponent <EntityHealth>(); Burn = Dependancy.Get <EntityBurn>(gameObject); }
protected virtual void Reset() { audioSource = Dependancy.Get <AudioSource>(gameObject, Dependancy.Scope.RecursiveToParents); }
protected virtual void Awake() { toggle = Dependancy.Get <Toggle>(gameObject, Dependancy.Scope.RecursiveToParents); toggle.onValueChanged.AddListener(OnChange); }
public static void Init <TReference>(TReference reference) where TReference : Component { Init(reference, Dependancy.GetAll <Interface <TReference> >(reference.gameObject)); }
public virtual void Configure() { Label = Dependancy.Get <Text>(gameObject); }