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

            Disable();
        }
예제 #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());
        }
예제 #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();
        }
예제 #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;
         }
     }
 }
예제 #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);
                }
            }
        }
예제 #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());
        }
예제 #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;
            }
        }
예제 #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();
            }
        }
예제 #12
0
        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();
            }
        }
예제 #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);
 }
예제 #16
0
        public void Init(Entity reference)
        {
            Entity = reference;

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

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

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

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

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