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

            Disable();
        }
Ejemplo 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());
        }
Ejemplo 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();
        }
Ejemplo 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;
         }
     }
 }
Ejemplo 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);
                }
            }
        }
Ejemplo 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());
        }
Ejemplo 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;
            }
        }
Ejemplo 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();
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo 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);
 }
Ejemplo n.º 16
0
        public void Init(Entity reference)
        {
            Entity = reference;

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

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

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

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

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