示例#1
0
    public override void Play()
    {
        base.Play();
        Shimmy s = GameObject.AddComponent <Shimmy>();

        s.direction = 1;
    }
示例#2
0
        public void BasicTest()
        {
            var test = string.Empty;

            var testShimmy = Shimmy.CreateShimmy <ShimMe>(typeof(ShimMe), new ShimmySettings());
            // var iEnumerableShimmy = Shimmy.CreateShimmy<IEnumerable<string>>(typeof(IEnumerable<string>));

            // iEnumerableShimmy.GetShim(nameof(IEnumerable<string>.GetEnumerator)).With()

            var realShim = testShimmy.GetShim(nameof(ShimMe.PublicInstanceParameters), false, typeof(string), typeof(string));

            realShim.With((ShimMe @this, string s) => "Wow, getting Shims worked right out of the box!");

            var newFrameworkShim =
                Shim.Replace(() => Is.A <IEnumerable <string> >().FirstOrDefault(Is.A <Func <string, bool> >()))
                .With((IEnumerable <string> @this, Func <string, bool> func) => @this.FirstOrDefault(func));
            //var otherFrameworkShim = Shim.Replace(() => string.Format(Is.A<string>(), Is.A<object[]>()))
            //    .With((string replacement, object[] args) => string.Format(replacement, args));
            //var otherOtherFrameworkShim = Shim.Replace(() => string.Format(Is.A<string>(), Is.A<object>()))
            //    .With((string replacement, object args) => string.Format(replacement, args));
            var otherOtherOtherFrameworkShim = Shim.Replace(() => string.Format(Is.A <string>(), Is.A <object>(), Is.A <object>()), false)
                                               .With((string replacement, object args, object otherArg) =>
            {
                return(string.Format(replacement, args, otherArg));
            });
            var moreFrameworkShim = Shim.Replace(() => string.Format(Is.A <string>(), Is.A <object>()), false)
                                    .With((string replacement, object arg) =>
            {
                return(string.Format(replacement, arg));
            });

            // var otherRealShim = testShimmy.GetShim("get_PublicProperty");

            Poise.Poise.Run(() => { test = DontShimMe.TestMeThough(); }, new List <Shimmy> {
                testShimmy
            },
                            new List <Shim>()
            {
                newFrameworkShim, otherOtherOtherFrameworkShim, moreFrameworkShim
            });                                                                                    //otherOtherOtherFrameworkShim });//, iEnumerableShimmy });

            Debug.WriteLine(test);
        }
示例#3
0
    public void UpdatePosition()
    {
        if (Waypoints().Length == 0)
        {
            return;
        }

        int     index = GetCurrentWaypointIndex();
        float   waypointTransition     = GetCurrentWaypointTransition();
        Vector3 waypointOriginPosition = (index > 0) ? Waypoints()[index - 1].GetTargetPosition() : OriginPosition;

        transform.position = getPosition(waypointOriginPosition, Waypoints()[index].GetTargetPosition(), waypointTransition, Waypoints()[index].Type);

        if (gameObject.GetComponent <Facer>())
        {
            gameObject.GetComponent <Facer>().UpdateFacing();
        }

        foreach (TileOccupier tO in GameObject.Find("Units").transform.GetComponentsInChildren <TileOccupier>())
        {
            if (tO.gameObject != gameObject && Vector3.Distance(tO.transform.position, transform.position) < .2f && tO.GetComponent <Shimmy>() == null)
            {
                Shimmy s = tO.gameObject.AddComponent <Shimmy>();
                if (transform.eulerAngles.y == 270)
                {
                    s.direction = 0;
                }
                else if (transform.eulerAngles.y == 180)
                {
                    s.direction = 1;
                }
                else if (transform.eulerAngles.y == 90)
                {
                    s.direction = 1;
                }
                else if (transform.eulerAngles.y == 0)
                {
                    s.direction = 3;
                }
            }
        }
    }