상속: MonoBehaviour
예제 #1
0
        public void Update()
        {
            if (!(this.State is SDeadMario))
            {
                if (HUD.TIME == 0)
                {
                    this.State = new SDeadMario(this);
                }
                else if (Position.Y > HotDAMN.WINDOW_HEIGHT)
                {
                    HUD.level.PlayerFallsOffScreen();
                }
            }
            if (AutoMove != null && AutoMove.IsActive)
            {
                AutoMove.Update();
            }
            Velocity += Acceleration;
            Position += Velocity;
            State.Update();
            Sprite.Update();
            if (Velocity.Y > Physics.TERMINAL_VELOCITY_FALLING)
            {
                Velocity = new Vector2(Velocity.X, Physics.TERMINAL_VELOCITY_FALLING);
            }
            float terminalVelocity = IsRunning ? Physics.TERMINAL_VELOCITY_RUNNING : Physics.TERMINAL_VELOCITY_WALKING;

            if (Velocity.X > terminalVelocity || Velocity.X < -terminalVelocity)
            {
                Velocity = new Vector2(Velocity.X * 0.9f, Velocity.Y);
            }
        }
예제 #2
0
    void Start()
    {
        int oldSeed = Random.seed;

        if (useSeed)
        {
            Random.seed = seed;
        }

        AutoMove mover = GetComponent <AutoMove>();

        if (mover != null)
        {
            Vector3 v = mover.velocity;
            v.x           *= Eval(x, min.x, max.x);
            v.y           *= Eval(y, min.y, max.y);
            v.z           *= Eval(z, min.z, max.z);
            mover.velocity = v;
        }

        if (useSeed)
        {
            Random.seed = oldSeed; seed++;
        }
        Destroy(this);
    }
    public void LoadResources()
    {
        //Load some landscaping static resources
        groundLeft       = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(-3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject;
        groundLeft.name  = "GroundLeft";
        groundRight      = Object.Instantiate(Resources.Load("Prefabs/Solid"), new Vector3(3.75f, -0.4f, -5.5f), Quaternion.identity) as GameObject;
        groundRight.name = "GroundRight";
        river            = Object.Instantiate(Resources.Load("Prefabs/River"), new Vector3(0, -0.81f, -5.5f), Quaternion.identity) as GameObject;
        river.name       = "River";

        //Load important game objects
        boat = new Boat(1);
        Vector3[] priestLandPos = new Vector3[3] {
            new Vector3(-2.9f, 1.1f, -5.5f), new Vector3(-3.4f, 1.1f, -5.5f), new Vector3(-3.9f, 1.1f, -5.5f)
        };
        for (int i = 0; i < 3; i++)
        {
            objPriest[i] = new Priest(i, priestLandPos[i]);
        }
        Vector3[] devilLandPos = new Vector3[3] {
            new Vector3(-4.4f, 1.0f, -5.5f), new Vector3(-4.9f, 1.0f, -5.5f), new Vector3(-5.4f, 1.0f, -5.5f)
        };
        for (int i = 0; i < 3; i++)
        {
            objDevil[i] = new Devil(i, devilLandPos[i]);
        }
        judgement.startTimer();
        //StartCoroutine(waitForOneSecond());
        aimove = new AutoMove(objPriest, objDevil, boat);
        tips   = aimove.AIMove();
    }
예제 #4
0
 void Start()
 { //sets up display
     s = FindObjectOfType <SoundManager>();
     a = FindObjectOfType <AutoMove>();
     DontDestroyOnLoad(s);
     DontDestroyOnLoad(g);
     health        = maxHealth;
     txtLives.text = "" + health;
     txtScore.text = "" + GameManager.Instance.score;
 }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     shotPointsRight = new GameObject[] { shotPoints [0], shotPoints[2] };
     shotPointsLeft  = new GameObject[] { shotPoints [1], shotPoints[3] };
     anim            = GetComponent <Animator> ();
     autoMove        = GetComponent <AutoMove> ();
     pathComponent   = GetComponent <TweenMove> ();
     target          = GetComponent <Target> ();
     target.dead.AddListener(AfterDead);
     controller = GameObject.FindObjectOfType <GameController> ();
 }
예제 #6
0
    public void CreateItem(ItemType itemType, int row, int col)
    {
        bool isSpeedUp  = false;
        bool isAutoMove = false;

        GameObject toSpawn = null;

        switch (itemType)
        {
        case ItemType.SpeedUpItem:
            toSpawn   = speedUpItem;
            isSpeedUp = true;
            break;

        case ItemType.SpeedUpItemSpace:
            toSpawn   = speedUpItemSpace;
            isSpeedUp = true;
            break;

        case ItemType.DragonflyItem:
            toSpawn    = dragonflyItem;
            isSpeedUp  = true;
            isAutoMove = true;
            break;

        case ItemType.DragonflyItemSpace:
            toSpawn    = dragonflyItemSpace;
            isSpeedUp  = true;
            isAutoMove = true;
            break;

        default:
            Debug.LogError("ItemManager#CreateItemAtPosition: Unhandled item type!");
            return;
        }

        GameObject item = Instantiate(
            toSpawn,
            Level.GetSingleton().GetLilypadOriginWorldCoordinate(row, col),
            Quaternion.identity);

        if (isSpeedUp)
        {
            SpeedUpItem speedUpItemScript = item.GetComponent <SpeedUpItem>();
            speedUpItemScript.SpawnAt(row, col);
            speedUpItemScript.enabled = true;
        }
        if (isAutoMove)
        {
            AutoMove autoMoveScript = item.GetComponent <AutoMove>();
            autoMoveScript.SpawnAt(row, col);
        }
    }
    // Use this for initialization
    void Start()
    {
        if (!isServer)
        {
            foreach (Transform child in transform)
            {
                child.gameObject.SetActive(false);
            }
        }

        autoMove = new AutoMove(this, localManager);
    }
예제 #8
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_TELEMOVE packet = (GC_TELEMOVE )ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic
            Obj_Character _objChar = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(packet.ObjId);

            if (_objChar == null)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }
            Vector3 targetPos = new Vector3(packet.TargetPosX / 100.0f, 0, packet.TargetPosZ / 100.0f);

            targetPos = ActiveScene.GetTerrainPosition(targetPos);
            //如果_objChar为轻功状态,则打断轻功
            if (_objChar.IsLightState)
            {
                //_objChar.EndLightSkillMove();
                _objChar.BeginTeleMoveInLight(targetPos);
            }
            //是否需要改变朝向
            if (packet.NeedChangeFaceto == 1)
            {
                _objChar.FaceTo(targetPos);
            }
            else
            {
                _objChar.IsMoveToNoFaceTo = true;
            }
            AutoMove autoMove = _objChar.AutoMoveComponent;

            if (autoMove != null)
            {
                autoMove.ResetAutoMove();
            }
            //向目标点移动
            _objChar.MoveTo(targetPos, null, 0);
            //是否需要播放附加动作
            if (packet.HasAnimaId && _objChar.AnimLogic != null)
            {
                _objChar.AnimLogic.Stop();
                _objChar.AnimLogic.Play(packet.AnimaId);
                //现在这里播放击退效果 todo临时的
                _objChar.PlayEffect(121);
            }

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
예제 #9
0
    public override void OnInspectorGUI()
    {
        //元のInspector部分を表示
        base.OnInspectorGUI();

        //targetを変換して対象を取得
        AutoMove autoMove = target as AutoMove;

        if (GUILayout.Button(autoMove.TargetPointName()))
        {
            //SendMessageを使って実行
            autoMove.SendMessage("SwitchTarget", null, SendMessageOptions.DontRequireReceiver);
        }
    }
예제 #10
0
 // Start is called before the first frame update
 void Start()
 {
     SpawMember();
     if (useRoute)
     {
         for (int i = 0; i < memberCount; i++)
         {
             AutoMove autoMove = memberInstances[i].GetComponent <AutoMove>();
             autoMove.enabled = false;
             OnRouteMove onRouteMove = memberInstances[i].GetComponent <OnRouteMove>();
             onRouteMove.routeGameObject = routeGameObject;
             onRouteMove.enabled         = true;
         }
     }
     isAce = false;
 }
예제 #11
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag(Tags.player);
        enemyManager = EnemyManager._instance;

        playerAutoMove = player.GetComponent<AutoMove>();
        if (eventObject1 != null)
        {
            tufeiAutoMove = eventObject1.GetComponent<AutoMove>();
        }

        playerState = PlayerState._instance;
        nextEvent = new EventDelegate();
        nextEvent.target = this;
        thisEventIsOver = false;
        setGameObjectHide();
    }
예제 #12
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_STOP packet = (GC_STOP)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }

            //临时代码,先返回,调试的时候打开
            //return (uint)PACKET_EXE.PACKET_EXE_CONTINUE;

            //判断ServerID
            if (packet.Serverid == GlobeVar.INVALID_ID)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }

            //查找该NPC
            Obj_Character obj = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(packet.Serverid);

            if (null == obj)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }
            //轻功状态下停止轻功
            if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
            {
                Obj_OtherPlayer _otherPlayer = obj as Obj_OtherPlayer;
                if (_otherPlayer && _otherPlayer.IsLightState)
                {
                    _otherPlayer.EndLightSkillMove();
                }
            }
            //查找Obj是否绑定AutoMove组件
            AutoMove autoMove = obj.AutoMoveComponent;

            if (null != autoMove)
            {
                autoMove.InterruptMove(packet);
            }

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
예제 #13
0
            public override string ToString()
            {
                var U   = CodeSelBot.CodeSEL.GetUser(UserID);
                var Out = U.Mention + ((U.Nickname == null) ? "" : "  AKA `" + U.Name + "`")
                          + "\n\n`Discriminator:`     #" + U.Discriminator
                          + "\n`Long ID      :`     " + UserID
                          + "\n`Join Date    :`     " + U.JoinedAt.ToShortDateString()
                          + "\n`Currently    :`     " + ((U.Status.ToString() == "idle") ? "AFK, " : "") + ((U.Status.ToString() == "dnd") ? "Busy, " : "")
                          + ((U.Status.ToString() != "offline") ?
                             "Online since " + OnlineSince.AddHours(-2).ToShortTimeString() + " GMT"
                                        : "Offline" + ((LastOnline.ToString() != "01-Jan-01 12:00:00 AM") ? ", Last Seen on " + LastOnline.AddHours(-2).ToString() : ""))
                          + ((U.Status.ToString() == "online" && U.CurrentGame.HasValue && !U.IsBot) ? "\n`Playing      :`     " + U.CurrentGame.Value.Name : "")
                          + "\n`Msgs Sent    :`     " + MessagesSent
                          + "\n`Chars Sent   :`     " + CharactersSent
                          + ((ExileTime > 0) ? "\n`Exile Time   :`     " + ExileTime : "")
                          + ((BanCount > 0) ? "\n`Ban Votes    :`     " + BanCount : "")
                          + ((TimesMoved > 0) ? "\n`Times Moved  :`     " + TimesMoved : "")
                          + ((!U.IsBot && false) ?
                             "\n`Hangs Started:`     " + HangStarted +
                             "\n`Hangs Solved :`     " + HangSolved +
                             "\n`Songs Played :`     " + SongsPlayed : "")
                          + "\n`AFKmove      :`     " + AFKMove.ToString()
                          + "\n`Automove     :`     " + AutoMove.ToString()
                          + "\n`Allow Track  :`     " + Track.ToString();

                if (Games.Count > 0 && !U.IsBot)
                {
                    Out += "\n`Games        :`     ";
                    foreach (var g in Games)
                    {
                        Out += g + ", ";
                    }
                    Out = Out.Substring(0, Out.Length - 2);
                }
                Out += "\n`Roles        :`     ";
                foreach (var r in U.Roles.Where(x => x != CodeSelBot.CodeSEL.EveryoneRole).OrderBy(o => o.Position))
                {
                    Out += r.Mention + "  ";
                }
                return(Out);
            }
예제 #14
0
    private void FixedUpdate()
    {
        if (!m_running)
        {
            return;
        }

        if (m_autoMove == AutoMove.None)
        {
            m_autoMove       = AutoMove.GoOut;
            m_targetPosition = m_maxPoint.position;
        }

        if (Inputs.GetFire1(m_playerId))
        {
            if (m_autoMove == AutoMove.None || Time.fixedTime - m_lastIn > m_params.coolDownIn)
            {
                m_lastIn         = Time.fixedTime;
                m_autoMove       = AutoMove.GoIn;
                m_targetPosition = m_minPoint.position;
            }
        }

        Vector3 currentPos = m_startRigidBody.position;
        var     delta      = m_targetPosition - currentPos;

        if (delta.sqrMagnitude < 0.001f || m_autoMove == AutoMove.None)
        {
            m_autoMove = AutoMove.None;
            m_startRigidBody.MovePosition(m_targetPosition);
        }
        else
        {
            var speed = m_autoMove == AutoMove.GoIn ? m_params.inSpeed : m_params.outSpeed;
            currentPos += speed * Time.fixedDeltaTime * delta;
            m_startRigidBody.MovePosition(currentPos);
            m_tongueEnd.Move(delta);
            //m_tongueStart.position = currentPos;
        }
    }
예제 #15
0
    //放置文本框,独立于游戏世界-基于x,y
    public void setTextMove(string str, float time, float posX, float posY)
    {
        GameObject obj;
        Vector3    pos;

        pos = Vector3.zero;
        obj = (GameObject)Instantiate(textKuangMove, pos, Quaternion.identity);
        obj.transform.SetParent(this.transform.Find("TextCanvas").transform);
        RectTransform rectRra = obj.GetComponent <RectTransform>();

        pos   = Vector3.zero;
        pos.x = posX;
        pos.y = posY;
        pos.z = 0f;
        rectRra.anchoredPosition3D = pos;
        Text text = obj.GetComponentInChildren <Text>();

        text.text = str;
        AutoMove autoMove = obj.GetComponent <AutoMove>();

        autoMove.startMove(time);
    }
예제 #16
0
파일: Menu.cs 프로젝트: LuciusShadow/ErgoVR
    /***********************************************************
     * Methode: Start
     * Beschreibung: Initialisierung der Skriptreferenzen und
     * Checkboxstatus
     * Parameter: keine
     * Rückgabewert: keiner
     ***********************************************************/
    void Start()
    {
        startPos = Bike.transform.position;
        startRot = Bike.transform.eulerAngles;
        moveBike = Bike.GetComponent<MoveBike>();
        moveBikeAuto = Bike.GetComponent<AutoMove>();

        bikePitch = BikeBody.GetComponent<BikePitch>();

        handlebars = Handlebars.GetComponent<Handlebars>();
        autoSteer = Handlebars.GetComponent<AutoSteer>();

        toggleMove.isOn = moveBike.enabled;
        togglePitch.isOn = bikePitch.enabled;
        toggleHandle.isOn = handlebars.enabled;
    }
예제 #17
0
    // Use this for initialization
    void Start()
    {
        AutoMoveScript = gameObject.GetComponent <AutoMove>();

        Debug.Log(AutoMoveScript.line_direction);
    }
예제 #18
0
    // Use this for initialization
    void Start()
    {
        AutoMoveScript = gameObject.GetComponent<AutoMove>();

        Debug.Log(AutoMoveScript.line_direction);
    }
예제 #19
0
 void OnEnable()
 {
     script = target as AutoMove;
 }
예제 #20
0
 void OnEnable()
 {
     script = target as AutoMove;
 }
예제 #21
0
 // Use this for initialization
 void Start()
 {
     a = FindObjectOfType <AutoMove>();
 }
예제 #22
0
        public uint Execute(PacketDistributed ipacket)
        {
            GC_MOVE packet = (GC_MOVE)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }

            //临时代码,先返回,调试的时候打开
            //return (uint)PACKET_EXE.PACKET_EXE_CONTINUE;

            //判断ServerID
            if (packet.Serverid == GlobeVar.INVALID_ID)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }

            //查找该NPC
            Obj_Character obj = Singleton <ObjManager> .GetInstance().FindObjCharacterInScene(packet.Serverid);

            if (null == obj)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }

            //主玩家,消息包无效
            if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
            {
                return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
            }

            //主玩家伙伴,消息包无效
            if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_FELLOW)
            {
                Obj_Fellow objFellow = obj as Obj_Fellow;
                if (objFellow.OwnerObjId == Singleton <ObjManager> .GetInstance().MainPlayer.ServerID)
                {
                    return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
                }
            }

            if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
            {
                Obj_OtherPlayer objOther = obj as Obj_OtherPlayer;
                if (null != objOther)
                {
                    if (objOther.QingGongState == true || objOther.IsLightState == true || objOther.BindParent > 0)
                    {
                        return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
                    }

                    if (objOther.AnimLogic != null && objOther.AnimLogic.CurAnimData != null)
                    {
                        if (objOther.AnimLogic.CurAnimData.AnimID == (int)CharacterDefine.CharacterAnimId.Hit)
                        {
                            objOther.AnimLogic.Stop();
                        }
                        else if (objOther.SkillCore != null && objOther.SkillCore.UsingSkillBaseInfo != null && objOther.SkillCore.UsingSkillBaseInfo.IsMove != 1)
                        {
                            int nAnimationId = objOther.SkillCore.UsingSkillStartAni;
                            while (nAnimationId != GlobeVar.INVALID_ID)
                            {
                                if (nAnimationId == objOther.AnimLogic.CurAnimData.AnimID)
                                {
                                    objOther.AnimLogic.Stop();
                                    break;
                                }

                                Tab_Animation tabAnimation = TableManager.GetAnimationByID(nAnimationId, 0);
                                if (tabAnimation == null)
                                {
                                    break;
                                }

                                nAnimationId = tabAnimation.NextAnimId;
                            }
                        }
                    }

                    if (objOther.SkillCore.UsingSkillStartAni != GlobeVar.INVALID_ID && objOther.SkillCore.UsingSkillBaseInfo == null)
                    {
                        objOther.SkillCore.UsingSkillStartAni = GlobeVar.INVALID_ID;
                    }
                }
            }

            //查找Obj是否绑定AutoMove组件
            AutoMove autoMove = obj.AutoMoveComponent;

            if (null != autoMove)
            {
                autoMove.InsertAutoMovePoint(packet);
            }

            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }