예제 #1
0
        void Start()
        {
            // コンテナ取得
            _container = GetComponent <ElementContainer>();

            // ロックオン関連の初期化
            _lockOn = this.gameObject.AddComponent <LockOn.LockOn>();


            if (!_dataPanel)
            {
                _dataPanel = GameObject.Find("DataPanel");
            }
        }
예제 #2
0
        void Update()
        {
            // 選択
            // 選択したオブジェクトを取得
            var selectObj = GetClickObject();

            TargetObject(selectObj);
            var con = GameController.Instance;

            var  isTarget = TargetChoice.None;
            bool isSelect = false;
            bool isChange = false;

            if (con.GetConnectFlag())
            {
                isTarget = con.ButtonDown(Button.R1) ? TargetChoice.Front :
                           con.ButtonDown(Button.L1) ? TargetChoice.Next : TargetChoice.None;

                isSelect = con.ButtonDown(Button.A);
                isChange = con.ButtonDown(Button.X);
            }
            else
            {
                isTarget = Input.GetKeyDown(KeyCode.Space) ? TargetChoice.Next : TargetChoice.None;
                isSelect = Input.GetKeyDown(KeyCode.Z);
                isChange = Input.GetKeyDown(KeyCode.C);
            }

            if (isTarget != TargetChoice.None)
            {
                if (_targetList == null)
                {
                    var lockOn = new LockOn.LockOn();
                    _targetList = lockOn.GetLockOnList();
                    _targetNum  = lockOn.GetNearObjOnList();
                }

                // 次のターゲットオブジェクトを取得
                if (isTarget != TargetChoice.Next)
                {
                    // 選択
                    TargetObject(GetNextTarget());
                }
                else if (isTarget != TargetChoice.Front)
                {
                    TargetObject(GetOldTarget());
                }
            }

            // 要素吸出し
            if (isSelect)
            {
                if (_targetObject)
                {
                    SelectObject();
                }
            }

            // 選択要素切り替え
            if (Input.GetKeyDown(KeyCode.X))
            {
                if (_selectObject)
                {
                    // 次の要素を取得
                    ChangeNextElement();
                }
            }

            // 要素を移す
            if (isChange)
            {
                MoveElement(_targetObject);
            }
        }