Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Alkanoider") == true)
        {
            vector  = collision.transform.position - transform.position;
            vector  = vector.normalized;
            vector *= -1;
        }
        if (collision.CompareTag("AlkanoidWall") == true)
        {
            switch (moveX)
            {
            case MoveX.Right:
                moveX = MoveX.Left;
                break;

            case MoveX.Left:
                moveX = MoveX.Right;
                break;
            }
            vector.x *= -1;
        }
        if (collision.CompareTag("AlkanoidBlock") == true)
        {
            vector.y *= -1;
        }
    }
Esempio n. 2
0
 void Start()
 {
     rgBody      = gameObject.GetComponent <Rigidbody2D>();
     sprRenderer = gameObject.GetComponent <SpriteRenderer>();
     moveX       = gameObject.AddComponent <MoveX>();
     jump        = gameObject.AddComponent <Jump>();
 }
Esempio n. 3
0
    bool isStartAct = false;            // 行動開始するか

    // Use this for initialization
    void Start()
    {
        // 他のクラスでも使う関数を切り出した
        //generalFunc = new GeneralFunc ();

        // 左右の向きを親クラスから取得
        moveX  = this.GetComponentInParent <MoveX>();
        isLeft = moveX.GetIsLeft();

        // コピー用銛をDeactiveに
        boatSpear.SetActive(false);

        // 一斉攻撃のタイミング取得用
        // BoatManagerはGameController経由で取得
        gameControllerObj = GameObject.FindWithTag("GameController");
        gameCtrl          = gameControllerObj.GetComponent <GameController>();
        boatManager       = gameCtrl.GetBoatManager();


        // 設定値取得等の初期設定
        InitSetting();

        // ダメージの確認用
        boatDamage = this.GetComponent <BoatDamage> ();

        // 銛関係のマネージャ
        GameObject   obj           = new GameObject("SpearManger");
        SpearManager smAddComponet = obj.AddComponent <SpearManager> ();

        spearManager = smAddComponet;
    }
Esempio n. 4
0
        internal virtual void AddEvent(EventType e, EasingType easing, float startTime, float endTime, float[] start, float[] end)
        {
            CommonEvent newCommonEvent;

            if (end == null || end.Length == 0)
            {
                end = start;
            }

            switch (e)
            {
            case EventType.Fade:
                newCommonEvent = new Fade(easing, startTime, endTime, start[0], end[0]);
                break;

            case EventType.Move:
                newCommonEvent = new Move(easing, startTime, endTime, start[0], start[1], end[0], end[1]);
                break;

            case EventType.MoveX:
                newCommonEvent = new MoveX(easing, startTime, endTime, start[0], end[0]);
                break;

            case EventType.MoveY:
                newCommonEvent = new MoveY(easing, startTime, endTime, start[0], end[0]);
                break;

            case EventType.Scale:
                newCommonEvent = new Scale(easing, startTime, endTime, start[0], end[0]);
                break;

            case EventType.Vector:
                newCommonEvent = new Vector(easing, startTime, endTime, start[0], start[1], end[0], end[1]);
                break;

            case EventType.Rotate:
                newCommonEvent = new Rotate(easing, startTime, endTime, start[0], end[0]);
                break;

            case EventType.Color:
                newCommonEvent = new Color(easing, startTime, endTime, start[0], start[1], start[2], end[0], end[1], end[2]);
                break;

            case EventType.Parameter:
                newCommonEvent = new Parameter(easing, startTime, endTime, (ParameterType)(int)start[0]);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(e), e, null);
            }

            //List
            //if (sequential)
            //    EventList.AddSorted(newEvent);
            //else
            //    EventList.Add(newEvent);

            //SortedSet
            EventList.Add(newCommonEvent);
        }
Esempio n. 5
0
    private void OnEnable()
    {
        transform.localPosition = onEnablePosition;
        vector = Quaternion.Euler(0, 0, -45) * Vector3.up;
        moveX  = MoveX.Right;

        StartCoroutine(CorMove());
    }
Esempio n. 6
0
        public Models.VisualScript.Action GetAction()
        {
            var direction = IsDirectionLeft ? "Left" : "Right";

            Models.VisualScript.Action action = new MoveX(direction, Speed);

            return(action);
        }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        // 漁師の絵を選択
        spRender        = this.GetComponent <SpriteRenderer> ();
        spRender.sprite = SelectFisherManType();

        // 左右の向きを親クラスから取得
        moveX          = this.GetComponentInParent <MoveX>();
        isLeft         = moveX.GetIsLeft();
        spRender.flipX = isLeft;
    }
Esempio n. 8
0
        internal virtual void AddEvent(EventType e, EasingType easing, float startTime, float endTime, float[] start, float[] end)
        {
            CommonEvent newCommonEvent;

            if (end == null || end.Length == 0)
            {
                end = start;
            }

            if (e == EventTypes.Fade)
            {
                newCommonEvent = new Fade(easing, startTime, endTime, start[0], end[0]);
            }
            else if (e == EventTypes.Move)
            {
                newCommonEvent = new Move(easing, startTime, endTime, start[0], start[1], end[0], end[1]);
            }
            else if (e == EventTypes.MoveX)
            {
                newCommonEvent = new MoveX(easing, startTime, endTime, start[0], end[0]);
            }
            else if (e == EventTypes.MoveY)
            {
                newCommonEvent = new MoveY(easing, startTime, endTime, start[0], end[0]);
            }
            else if (e == EventTypes.Scale)
            {
                newCommonEvent = new Scale(easing, startTime, endTime, start[0], end[0]);
            }
            else if (e == EventTypes.Vector)
            {
                newCommonEvent = new Vector(easing, startTime, endTime, start[0], start[1], end[0], end[1]);
            }
            else if (e == EventTypes.Rotate)
            {
                newCommonEvent = new Rotate(easing, startTime, endTime, start[0], end[0]);
            }
            else if (e == EventTypes.Color)
            {
                newCommonEvent = new Color(easing, startTime, endTime, start[0], start[1], start[2], end[0], end[1],
                                           end[2]);
            }
            else if (e == EventTypes.Parameter)
            {
                newCommonEvent = new Parameter(easing, startTime, endTime, (ParameterType)(int)start[0]);
            }
            else
            {
                newCommonEvent = Register.GetEventTransformation(e)?.Invoke(e, easing, startTime, endTime, start, end);
                if (newCommonEvent == null)
                {
                    throw new ArgumentOutOfRangeException(nameof(e), e, null);
                }
            }

            //List
            //if (sequential)
            //    EventList.AddSorted(newEvent);
            //else
            //    EventList.Add(newEvent);

            //SortedSet
            EventList.Add(newCommonEvent);
        }