Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        protected virtual void Awake()
        {
            rigidbodies = Dependancy.GetAll <Rigidbody>(gameObject);
            colliders   = Dependancy.GetAll <Collider>(gameObject);

            Disable();
        }
Esempio n. 3
0
        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());
        }
Esempio n. 5
0
            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();
        }
Esempio n. 7
0
 public static void Apply(GameObject gameObject)
 {
     foreach (var renderer in Dependancy.GetAll <Renderer>(gameObject))
     {
         if (renderer.shadowCastingMode == ShadowCastingMode.On)
         {
             renderer.shadowCastingMode = ShadowCastingMode.TwoSided;
         }
     }
 }
Esempio n. 8
0
        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);
                }
            }
        }
Esempio n. 9
0
        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());
        }
Esempio n. 10
0
        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;
            }
        }
Esempio n. 11
0
        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();
            }
        }
Esempio n. 13
0
 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);
 }
Esempio n. 16
0
        public void Init(Entity reference)
        {
            Entity = reference;

            Animator = Dependancy.Get <Animator>(Entity.gameObject);
        }
Esempio n. 17
0
        public virtual void Init()
        {
            ConstraintArea = Dependancy.Get <ConstraintArea>(gameObject);

            List = new List <Player>();
        }
Esempio n. 18
0
        public void Init(Player reference)
        {
            this.player = reference;

            Sprint = Dependancy.Get <PlayerSprint>(player.gameObject);
        }
Esempio n. 19
0
        protected virtual void Awake()
        {
            Health = GetComponent <EntityHealth>();

            Burn = Dependancy.Get <EntityBurn>(gameObject);
        }
Esempio n. 20
0
 protected virtual void Reset()
 {
     audioSource = Dependancy.Get <AudioSource>(gameObject, Dependancy.Scope.RecursiveToParents);
 }
Esempio n. 21
0
        protected virtual void Awake()
        {
            toggle = Dependancy.Get <Toggle>(gameObject, Dependancy.Scope.RecursiveToParents);

            toggle.onValueChanged.AddListener(OnChange);
        }
Esempio n. 22
0
 public static void Init <TReference>(TReference reference)
     where TReference : Component
 {
     Init(reference, Dependancy.GetAll <Interface <TReference> >(reference.gameObject));
 }
Esempio n. 23
0
 public virtual void Configure()
 {
     Label = Dependancy.Get <Text>(gameObject);
 }