예제 #1
0
        public override void Initialize(GameObject sender, float delta)
        {
            Sender     = sender;
            Delta      = delta;
            TimeWaited = Delay;

            LookAt.SetToPosition(Direction.Center, sender.transform.position);
            if (WarppedMotionCopy != null)
            {
                Destroy(WarppedMotionCopy);
            }
            WarppedMotionCopy         = WrappedMotion.CopyTo(sender.gameObject);
            WarppedMotionCopy.enabled = false;
        }
예제 #2
0
        public override Motion CopyTo(GameObject go)
        {
            TargetedMotion copy = go.AddComponent <TargetedMotion>();

            copy.Target            = Target.Copy();
            copy.Degree            = Degree;
            copy.Speed             = Speed;
            copy.Invert            = Invert;
            copy.HideGizmo         = HideGizmo;
            copy.Sender            = Sender;
            copy.DegreeToTarget    = DegreeToTarget;
            copy.DegreeStepLength  = DegreeStepLength;
            copy.DegreeStepSize    = DegreeStepSize;
            copy.StepCounter       = StepCounter;
            copy.AlternativeMotion = AlternativeMotion == null? null : AlternativeMotion.CopyTo(go);

            return(copy);
        }
예제 #3
0
        protected virtual void OnEnable()
        {
            Motion.Initialize(gameObject, Delta);

            //if motion is not mine
            if (Motion.gameObject != gameObject)
            {
                //do i have one?
                Motion mine = GetComponent <Motion> ();
                if (mine != null)
                {
                    Motion = mine;
                }
                else //copy refrenced one to me
                {
                    Motion = Motion.CopyTo(gameObject);
                }
            }
        }