Inheritance: Movement
Example #1
0
        public void ForceHome()
        {
            var homePos = GetPosition(PositionType.Home);

            if (DebugMove)
            {
                Console.WriteLine($"{Name} ({Guid}) - ForceHome({homePos.ToLOCString()})");
            }

            var setPos = new SetPosition();

            setPos.Pos   = new Physics.Common.Position(homePos);
            setPos.Flags = SetPositionFlags.Teleport;

            PhysicsObj.SetPosition(setPos);

            UpdatePosition_SyncLocation();

            SendUpdatePosition();

            var actionChain = new ActionChain();

            actionChain.AddDelaySeconds(0.5f);
            actionChain.AddAction(this, Sleep);
            actionChain.EnqueueChain();
        }
            static List <Character> characterList = new List <Character>();           //for position rubbish

            public Character(string imageName, string characterColor)
            {
                this.characterColor = characterColor;

                loadImage   = new LoadImage(this);
                unloadImage = new UnloadImage(this);
                setPosition = new SetPosition(this);

                gameObject = UnityEngine.Object.Instantiate(Resources.Load <GameObject>("CharacterPrefab"));

                string[] words = imageName.Split('-');

                //backwards from SetImageName()
                if (words.Length >= 1)
                {
                    characterName = words[0];
                }

                if (words.Length >= 2)
                {
                    characterClothes = words[1];
                }

                if (words.Length >= 3)
                {
                    characterExpression = words[2];
                }

                if (characterName.Length > 0)
                {
                    loadImage.PushLoadImageEvent(true);
                }
            }
Example #3
0
 protected virtual void InitialUpdatePosition(SetPosition setPosition, float position, float maxPosition, float anchorMin)
 {
     if (anchorMin > .5f)
     {
         if (position < 0)
         {
             setPosition(0, true);
         }
         else if (maxPosition > 1f && position > maxPosition)
         {
             setPosition(maxPosition);
         }
     }
     else
     {
         if (maxPosition > 1f && position < -maxPosition)
         {
             setPosition(-maxPosition, true);
         }
         else if (position > 0)
         {
             setPosition(0);
         }
     }
 }
Example #4
0
        private DragAndDrop(DiagramItem attachedElement, GetPosition get, SetPosition set)
        {
            _item = attachedElement;
            _get  = get;
            _set  = set;

            hookEvents();
        }
Example #5
0
 private void Start()
 {
     buttonControler = GameObject.Find("Foods").GetComponent <ButtonControler>();
     controller      = GetComponent <CharacterController>();
     setPosition     = GetComponent <SetPosition>();
     setPosition.CreateRandomPosition();
     elapsedTime = 0f;
 }
Example #6
0
 public void Toggle_Video_Position_Update()
 {
     bUpdateVidPos = !bUpdateVidPos;
     if (bUpdateVidPos)
     {
         DataReqEventArgs eData = new DataReqEventArgs();
         eData.Position = new TimeSpan(0, 0, 0, 0, Convert.ToInt32(dSaveVidPos));
         SetPosition?.Invoke(this, eData);
     }
 }
Example #7
0
    public override void Start()
    {
        turretControl       = GameObject.Find(gameObject.transform.root.name + "TurretControl").transform;
        difficulty          = transform.root.GetComponent("BotDifficulty") as BotDifficulty;
        turretTraverseSpeed = difficulty.TurretTraverseSpeed;
        shootRange          = difficulty.ShootDistance;

        WithinRange = GameObject.FindGameObjectWithTag("Bot").GetComponent("SetPosition") as SetPosition;
        player      = GameObject.Find(GameObject.FindGameObjectWithTag("Player").name + "Chassis");
        enemy       = player.transform;
    }
Example #8
0
	public override void Start ()
	{
		turretControl = GameObject.Find (gameObject.transform.root.name + "TurretControl").transform;
		difficulty = transform.root.GetComponent("BotDifficulty") as BotDifficulty;
		turretTraverseSpeed = difficulty.TurretTraverseSpeed;
		shootRange = difficulty.ShootDistance;
		
		WithinRange = GameObject.FindGameObjectWithTag("Bot").GetComponent("SetPosition") as SetPosition;
		player = GameObject.Find(GameObject.FindGameObjectWithTag("Player").name + "Chassis");
		enemy = player.transform;
	}
Example #9
0
 // Start is called before the first frame update
 void Start()
 {
     enemyController = GetComponent <CharacterController>();
     animator        = GetComponent <Animator>();
     setPosition     = GetComponent <SetPosition>();
     setPosition.CreateRandomPosition();
     velocity    = Vector3.zero;
     arrived     = false;
     elapsedTime = 0f;
     SetState(EnemyState.Walk);
 }
Example #10
0
 void Start()
 {
     soundManager = SoundManager.Instance;
     animator     = GetComponent <Animator>();
     setPosition  = GetComponent <SetPosition>();
     destination  = setPosition.GetDestination();
     velocity     = Vector3.zero;
     arrived      = false;
     elapsedTime  = 3f;
     SetState(EnemyState.Walk);
     particle = GetComponentInChildren <ParticleSystem>();
 }
Example #11
0
        private static IEnumerator Move(SetPosition setPosition, float duration)
        {
            var startTime = Time.realtimeSinceStartup;
            var fraction  = 0.0f;

            while (fraction < 1f)
            {
                fraction = Mathf.Clamp01((Time.realtimeSinceStartup - startTime) / duration);
                setPosition(fraction);
                yield return(new WaitForEndOfFrame());
            }
        }
Example #12
0
        private static IEnumerator Move(this UnityEngine.Transform transform, SetPosition setPosition, float duration, bool isOnTop)
        {
            var siblingIndex = transform.GetSiblingIndex();

            if (isOnTop)
            {
                transform.SetAsLastSibling();
            }
            yield return(Move(setPosition, duration));

            transform.SetSiblingIndex(siblingIndex);
        }
Example #13
0
    private void Update()
    {
        if (hudPoint.enable && currentTransform != null)
        {
            hudPoint.SetPoint(currentTransform.TransformPoint(localPos));
        }
        if (client == null)
        {
            return;
        }
        if (!client.Connected)
        {
            Error.ShowError(startScene, "Server Disconnected");
            return;
        }

        Telepathy.Message msg;
        while (client.GetNextMessage(out msg))
        {
            switch (msg.eventType)
            {
            case Telepathy.EventType.Connected:
                break;

            case Telepathy.EventType.Data:
                SetPosition setPosition = DataParser.DeserializeObject <SetPosition>(msg.data);
                if (setPosition != null)
                {
                    process(setPosition);
                    break;
                }
                SetModel setModel = DataParser.DeserializeObject <SetModel>(msg.data);
                if (setModel != null)
                {
                    process(setModel);
                    break;
                }
                FileObject fileObject = DataParser.DeserializeObject <FileObject>(msg.data);
                if (fileObject != null)
                {
                    process(fileObject);
                    break;
                }

                break;

            case Telepathy.EventType.Disconnected:
                Error.ShowError(startScene, "Server Disconnected");
                break;
            }
        }
    }
Example #14
0
    public static bool End;                             //ゲーム終了判定


    void Start()
    {
        enemyController = GetComponent <CharacterController>();      ///コンポネートを取得
        animator        = GetComponent <Animator>();
        setPosition     = GetComponent <SetPosition>();
        setPosition.CreateRandomPosition();
        velocity    = Vector3.zero;                                 //ベクトルを初期化
        arrival     = false;                                        //目的地へ向かう
        elapsedTime = 0f;
        SetState(EnemyState.Walk);
        audioSource = GetComponent <AudioSource> ();
        End         = false;
    }
Example #15
0
 private void process(SetPosition setPosition)
 {
     Debug.Log("got SetPosition" + setPosition.visible.ToString());
     if (setPosition.visible)
     {
         hudPoint.Show();
     }
     else
     {
         hudPoint.Hide();
     }
     localPos = new Vector3(setPosition.x, setPosition.y, setPosition.z);
 }
Example #16
0
    private void Start()
    {
        turret        = GameObject.Find(gameObject.transform.root.name + "TurretControl").transform;
        raySpawnPoint = GameObject.Find(gameObject.transform.root.name + "ShellSpawnPoint").transform;

        difficulty          = transform.root.GetComponent("BotDifficulty") as BotDifficulty;
        turretTraverseSpeed = difficulty.TurretTraverseSpeed;
        shootRange          = difficulty.ShootDistance;

        WithingRange = GameObject.FindGameObjectWithTag("Bot").GetComponent("SetPosition") as SetPosition;

        player   = GameObject.Find(GameObject.FindGameObjectWithTag("Player").name + "Turret");
        myTarget = player.transform;
    }
Example #17
0
	private void Start()
	{
		turret = GameObject.Find (gameObject.transform.root.name + "TurretControl").transform;
		raySpawnPoint = GameObject.Find (gameObject.transform.root.name + "ShellSpawnPoint").transform;
		
		difficulty = transform.root.GetComponent("BotDifficulty") as BotDifficulty;
		turretTraverseSpeed = difficulty.TurretTraverseSpeed;
		shootRange = difficulty.ShootDistance;
		
		WithingRange = GameObject.FindGameObjectWithTag("Bot").GetComponent("SetPosition") as SetPosition;
		
		player = GameObject.Find(GameObject.FindGameObjectWithTag("Player").name + "Turret");
		myTarget = player.transform;
	}
Example #18
0
    // Start is called before the first frame update
    void Start()
    {
        enemyController = GetComponent <CharacterController>(); //コントローラーを取得

        animator = GetComponent <Animator>();                   //アニメーターを取得

        setPosition = GetComponent <SetPosition>();             //SetPositionスクリプトの値を取得

        setPosition.CreateRandomPosition();                     //SetPositionスクリプトのCreateRandomPositionメソッドを使用

        destination = setPosition.GetDestination();             //SetPositionスクリプトのGetDestinationメソッドを使用して、destinationに値を代入

        velocity = Vector3.zero;                                //速度を0にする

        elapsedTime = 0f;                                       //経過時間を0にする
    }
Example #19
0
    public void Awake()
    {
        connections = new HashSet <int>();
        hudPoint.Hide();
        currentPosition         = new SetPosition();
        currentPosition.x       = 0;
        currentPosition.y       = 0;
        currentPosition.z       = 0;
        currentPosition.visible = false;
        textArray = new Text[bundle.names.Length];
        for (int i = 0; i < textArray.Length; i++)
        {
            GameObject head = Instantiate(header);
            textArray[i] = head.GetComponent <Text>();
            head.GetComponent <RectTransform>().SetParent(panel);
            textArray[i].text = bundle.names[i];
            head.GetComponent <RectTransform>().localScale = Vector3.one;
        }
        objects = new GameObject[textArray.Length];
        for (int i = 0; i < objects.Length; i++)
        {
            GameObject model = Instantiate(bundle.objects[i]);

            Transform t = model.GetComponent <Transform>();
            t.SetParent(viewer);
            t.localScale       = Vector3.one;
            t.localEulerAngles = Vector3.zero;
            DestroyCamera(t);
            objects[i] = model;

            Bounds bound = CalculateBound(t);

            float max = Mathf.Max(bound.size.x, bound.size.y, bound.size.z);
            if (Mathf.Approximately(max, 0f))
            {
                max = requiredSize;
            }
            float scale = requiredSize / max;
            t.localPosition = -bound.center * scale;
            t.localScale    = Vector3.one * scale;
            CreateMeshCollider(t);
        }
        changeModel(0);
    }
Example #20
0
 /// <summary>
 /// 改变时钟视图的位置
 /// </summary>
 /// <param name="b">true在左边,false在右边</param>
 public void PositionTransformation(bool b)
 {
     if (ViewGrid.Dispatcher.CheckAccess())
     {
         if (b) //左边
         {
             //ViewGrid.Margin = new Thickness(0,6, 7.167, 5);
             ViewGrid.Margin = new Thickness(0, 6, 7.167, 5);
         }
         else
         {//右边
             ViewGrid.Margin = new Thickness(0, 6, 180, 5);
         }
     }
     else
     {
         SetPosition position = PositionTransformation;
         ViewGrid.Dispatcher.Invoke(position, b);
     }
 }
Example #21
0
    private void Start()
    {
        turnplayer          = 1;
        changePoint         = GetComponent <ToChangePoint>();
        mapdata             = GetComponent <Mapdata>();
        setP                = GetComponent <SetPosition>();
        AmountOfWin         = 171;
        MotikinnSumIndexnum = mapdata.GetKomakindToIndexnum[-1];

        /*
         * turnChangeObj = GameObject.Find("TurnChangeObj");
         * tc = turnChangeObj.GetComponent<TurnChange>();
         */
        // turnOBJ1 = GameObject.FindGameObjectWithTag("turn1");
        // turnOBJ2 = GameObject.FindGameObjectWithTag("turn2");
        fadeoutOBJ = GameObject.Find("GameSetCanvas");
        fade       = fadeoutOBJ.GetComponent <FadeScript>();
        gameset    = false;
        fade.SetAlfa(1f);
        fade.Setfadein(true);
    }
Example #22
0
        public virtual void Update()
        {
            if (!IsBusy &&
                !IsReady &&
                IsCubemapAvailable &&
                texture == null)
            {
                this.Report(0);
                texture = GetCubemap(this);

                if (texture != null)
                {
                    skybox.exposure        = 1;
                    skybox.imageType       = SkyboxManager.ImageType.Degrees360;
                    skybox.layout          = SkyboxManager.Mode.Cube;
                    skybox.mirror180OnBack = false;
                    rotation            = skybox.rotation = LastRotation;
                    skybox.stereoLayout = SkyboxManager.StereoLayout.None;
                    skybox.tint         = Color.gray;
                    skybox.useMipMap    = false;
                    skybox.SetTexture(texture);

                    OnReady();
                }
            }
#if UNITY_EDITOR
            else if (rotation != LastRotation)
            {
                skybox.rotation = rotation;
                LastRotation    = rotation;
            }
            else if (transform.localPosition != lastPosition)
            {
                SetPosition?.Invoke(this, transform.localPosition);
                lastPosition = transform.localPosition;
            }
#endif
        }
Example #23
0
        protected virtual void LateUpdatePosition(SetPosition setPosition, float position, float maxPosition, float anchorMin)
        {
            float nextPosition;

            if (anchorMin > .5f)
            {
                if (position < 0)
                {
                    nextPosition = 0;
                }
                else if (maxPosition > 1f && position > maxPosition)
                {
                    nextPosition = maxPosition;
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (maxPosition > 1f && position < -maxPosition)
                {
                    nextPosition = -maxPosition;
                }
                else if (position > 0)
                {
                    nextPosition = 0;
                }
                else
                {
                    return;
                }
            }

            setPosition(nextPosition, true, true);
        }
Example #24
0
    private void OnConnectionStepChange()
    {
        if (!(FB.ConnectionStep != 1.0))
        {
            FB.Connect();
        }

        if (!(FB.ConnectionStep != 5.0))
        {
            if (!(FB.RoomData.Values.First() != FB.MyName))
            {
                MyPosition = 1;

                FB.MyData.Add("Car", "0 : 0");
                FB.SetValue();
            }
            else
            {
                MyPosition = 2;
            }

            SetPosition?.Invoke();
        }
    }
Example #25
0
        public HttpResponseMessage SetPosition(SetPosition req)
        {
            var riderId = Convert.ToInt32(req.riderId);

            var   tokenStr = req.Token;
            Token token    = CacheHelper.GetRiderToken(tokenStr);

            if (token == null)
            {
                return(ControllerHelper.Instance.JsonResult(400, "token失效"));
            }
            if (token.Payload.UserID != riderId)
            {
                return(ControllerHelper.Instance.JsonResult(400, "token错误"));
            }

            var rider     = RiderInfoOper.Instance.GetById(riderId);
            var lat       = req.lat;
            var lng       = req.lng;
            var riderType = rider.riderType;

            CacheHelper.SetRiderPosition(riderId, lat, lng, (int)riderType);
            return(ControllerHelper.Instance.JsonResult(200, "上传地址成功"));
        }
Example #26
0
        public static IEnumerator MoveBezierByLocalCoordinates(this UnityEngine.Transform transform, Vector3 position, Vector3 delta, float duration, AnimationCurve curve, bool isOnTop)
        {
            SetPosition setPos = t => transform.localPosition = GetQuadBezierPoint(transform.localPosition, delta, position, curve?.Evaluate(t) ?? t);

            yield return(transform.Move(setPos, duration, isOnTop));
        }
Example #27
0
        public static IEnumerator MoveByAnchoredPosition(this RectTransform transform, Vector3 position, float duration, AnimationCurve curve, bool isOnTop)
        {
            SetPosition setPos = t => transform.anchoredPosition = Vector3.Lerp(transform.anchoredPosition, position, curve?.Evaluate(t) ?? t);

            yield return(transform.Move(setPos, duration, isOnTop));
        }
Example #28
0
        public static IEnumerator MoveBezierByAnchoredPosition(this RectTransform transform, Vector3 position, Vector3 delta, float duration, AnimationCurve curve, bool isOnTop)
        {
            SetPosition setPos = t => transform.anchoredPosition = GetQuadBezierPoint(transform.anchoredPosition, delta, position, curve?.Evaluate(t) ?? t);

            yield return(transform.Move(setPos, duration, isOnTop));
        }
Example #29
0
 private void Start()
 {
     setPositionData = gameObject.transform.root.GetComponent <SetPosition>();
 }
Example #30
0
 internal static void Attach(DiagramItem attachedElement, GetPosition get, SetPosition set)
 {
     new DragAndDrop(attachedElement, get, set);
 }
Example #31
0
	private void Start()
	{
		setPositionData = gameObject.transform.root.GetComponent<SetPosition>();
	}
Example #32
0
 public void AddCarInRace(Car car)
 {
     delSetPosition += car.OnStart;
     mover          += car.Move;
     car.Finish     += ShowWinner;
 }
 /// <summary>
 /// Sends SetPosition message.
 /// </summary>
 private void SetPosition(SetPosition message)
 {
     FileStream.Seek(message.Position, SeekOrigin.Begin);
 }