Inheritance: MonoBehaviour
Example #1
0
    // Use this for initialization
    void Start()
    {
        character = GameObject.Find("Character");
        MoveCharacter characterControl = character.GetComponent <MoveCharacter>();

        if (value > 0)
        {
            characterControl.loot++;
        }
        prueba    = gameObject.GetComponent <Text>();
        startTime = Time.time;

        if (value < 0)
        {
            startPosition      = new Vector3(characterControl.xPos - 0.25f, 5.8f, 0);
            transform.position = startPosition;
            target             = new Vector3(characterControl.xPos - 0.5f, 6.2f, 0);
        }
        else if (value == 0)
        {
            startPosition      = new Vector3(characterControl.xPos, 5.8f, 0);
            transform.position = startPosition;
            target             = new Vector3(characterControl.xPos, 6.2f, 0);
        }
        else
        {
            startPosition      = new Vector3(characterControl.xPos + 0.25f, 5.8f, 0);
            transform.position = startPosition;
            target             = new Vector3(characterControl.xPos + 0.5f, 6.2f, 0);
        }
    }
	// Use this for initialization
	void Start () {
        rb = gameObject.GetComponent<Rigidbody2D>();
        moveCharacter = gameObject.GetComponent<MoveCharacter>();
        weaponController = gameObject.GetComponent<WeaponController>();
        spellController = gameObject.GetComponent<SpellController>();
        gameObject.GetComponent<Health>().OnDeath += onDeath;
	}
Example #3
0
        public void Update(MoveCharacter moveCharacter, MovementAction movementAction, Vector3 targetPosition, float rotation = 0f)
        {
            if (movementAction == MovementAction.DirectMove)
            {
                moveCharacter?.Invoke(targetPosition);
                return;
            }

            List <Vector3> forces = GetForces(movementAction, targetPosition, rotation);

            for (int i = 0; i < forces.Count; ++i)
            {
                Velocity += forces[i];
            }

            if (IsOnWaterSurface && Velocity.Z > 0f)
            {
                Velocity = new Vector3(Velocity.X, Velocity.Y, 0f);
            }

            Velocity.Limit(WowInterface.MovementSettings.MaxVelocity);

            Vector3 currentPosition = WowInterface.ObjectManager.Player.Position;

            currentPosition.Add(Velocity);

            moveCharacter?.Invoke(currentPosition);
        }
Example #4
0
        public void Update(MoveCharacter moveCharacter, MovementAction movementAction, Vector3 targetPosition, float rotation = 0f)
        {
            if (movementAction == MovementAction.DirectMove)
            {
                moveCharacter?.Invoke(targetPosition);
                return;
            }

            List <Vector3> forces = GetForces(movementAction, targetPosition, rotation);

            foreach (Vector3 force in forces)
            {
                Velocity += force;
            }

            if (IsOnWaterSurface && Velocity.Z > 0f)
            {
                Velocity = new(Velocity.X, Velocity.Y, 0f);
            }

            float maxVelocity = Config.MovementSettings.MaxVelocity;

            if (Bot.Player.IsMounted)
            {
                maxVelocity *= 2;
            }

            Velocity.Limit(maxVelocity);

            Vector3 currentPosition = Bot.Player.Position;

            currentPosition.Add(Velocity);

            moveCharacter?.Invoke(currentPosition);
        }
Example #5
0
    private void adjustPlayerStats(ItemTypes itemType)
    {
        if (!player)
        {
            player   = GameObject.Find("Player");
            movement = player.GetComponent <MoveCharacter>();
        }
        //maybe implement a timer for each boost
        switch (itemType)
        {
        case ItemTypes.AttackBoost:
            break;

        case ItemTypes.SpeedBoost:
            movement.playerSpeed = movement.playerSpeed + movement.playerSpeed * 0.5F;
            break;

        case ItemTypes.StealthBoost:
            break;

        case ItemTypes.Key:
            print("used key");
            MoveCharacter.usedKey = true;
            break;
        }
    }
Example #6
0
        public IEnumerator moveCharacter_Move()
        {
            GameObject    go       = new GameObject("Player");
            MoveCharacter moveChar = go.AddComponent <MoveCharacter>();


            yield return(null);
        }
Example #7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     _rigidbody2D = GetComponent <Rigidbody2D>();
 }
Example #8
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var movement = new MoveCharacter()
        {
            DeltaTime = Time.deltaTime, MaximumRotation = MaximumRotation
        };

        return(movement.Schedule(this, inputDeps));
    }
	// Use this for initialization
	void Start () {
        if (playerObject == null)
        {
            playerObject = GameObject.Find("Player");
        }
        moveCharacter = gameObject.GetComponent<MoveCharacter>();
        gameObject.GetComponent<Health>().OnDeath += onDeath;
        scoreController = GameObject.Find("ScoreController").GetComponent<ScoreController>();
	}
Example #10
0
    void OnEnable()
    {
        instance            = this;
        characterController = GetComponent <CharacterController>();
        anim = GetComponent <Animator>();
        cam  = Camera.main.transform;

        Debug.Log("Enable");
    }
    // Update is called once per frame
    void Update()
    {
        _speed = GameObject.FindGameObjectWithTag("Character").GetComponent <MoveCharacter>();

        if (stop == true)
        {
            canvas.SetActive(true);
        }
    }
Example #12
0
    private void Start()
    {
        CharA = GameObject.Find("ACharacter").GetComponent <MoveCharacter>();
        CharB = GameObject.Find("BCharacter").GetComponent <MoveCharacter>();
        CharC = GameObject.Find("CCharacter").GetComponent <MoveCharacter>();

        AplayerState = GameObject.Find("ACharacter").GetComponent <playerState>();
        BplayerState = GameObject.Find("BCharacter").GetComponent <playerState>();
        CplayerState = GameObject.Find("CCharacter").GetComponent <playerState>();
    }
    void Start()
    {
        player  = GameObject.FindGameObjectWithTag("Player");
        Move    = GetComponent <MoveCharacter>();
        Animate = GetComponent <AnimCharacter>();
        status  = GetComponent <Status>();
        RandomZombie();

        scriptUI = GameObject.FindObjectOfType(typeof(UIControl)) as UIControl;
    }
Example #14
0
    private void OnTriggerEnter(Collider obj)
    {
        prevMoveCharacter = obj.GetComponent <MoveCharacter>();
        prevMovePattern   = prevMoveCharacter.MovePattern;

        obj.GetComponent <MoveCharacter>().MovePattern = PowerUp.MovePattern;

        Invoke("RestoreMovePattern", TimeToRestore);

        gameObject.SetActive(false);
    }
Example #15
0
    void Start()
    {
        Dist = Vector2.zero;
        mc   = GetComponent <MoveCharacter>();
        cc   = GetComponent <CharacterControl>();

        //StartCoroutine(run);
        item  = GetComponent <AddItem>();
        stats = item.stats;
        AIplayer.AI.Add(GetComponent <Health>());
    }
Example #16
0
    // Use this for initialization
    void Start()
    {
        Movement_OnTouch = Vector2.zero;
        mc = GetComponent <MoveCharacter>();
        cc = GetComponent <CharacterControl>();

        cam.SetActive(cc.IsMine);
        this.enabled = cc.IsMine;

        //gameObject.SetActive(mc.IsMine);
        //this.enabled = mc.IsMine;
    }
Example #17
0
    private void Start()
    {
        tr     = GetComponent <Transform>();
        target = targetA;

        transform.localEulerAngles = new Vector3(65, 0, 0);


        CharA        = GameObject.Find("ACharacter").GetComponent <MoveCharacter>();
        CharB        = GameObject.Find("BCharacter").GetComponent <MoveCharacter>();
        CharC        = GameObject.Find("CCharacter").GetComponent <MoveCharacter>();
        CharAll_Join = GameObject.Find("Together").GetComponent <JointoTogether>();
    }
Example #18
0
    // Update is called once per frame
    void Update()
    {
        character = GameObject.Find("Character");
        MoveCharacter characterControl = character.GetComponent <MoveCharacter>();

        if (!characterControl.gameOver)
        {
            if (!characterControl.pauseToggle && Input.GetKeyDown("down") && (!Input.GetKeyDown("left") || Input.GetKeyDown("right")))
            {
                ypos += 2;
                transform.position = new Vector3(xpos, ypos, 0);
            }
            if (xpos == character.transform.position.x && ypos == character.transform.position.y)
            {
                if (!isMined)
                {
                    if (Input.GetKeyDown("left") || Input.GetKeyDown("right"))
                    {
                        characterControl.anim.SetBool("Lateral", true);
                    }

                    characterControl.moves   += totalValue;
                    characterControl.turnTime = characterControl.absoluteTurnTime;
                    isMined = true;

                    GameObject newNewLoot = Instantiate(newLoot, new Vector3(0, 8, 0), Quaternion.identity) as GameObject;
                    newNewLoot.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false);
                    NewLoot newLootControl = newNewLoot.GetComponent <NewLoot>();
                    newLootControl.value = value;
                    if (loot != Loot.Nothing)
                    {
                        GameObject newNewLoot2 = Instantiate(newLoot, new Vector3(0, 8, 0), Quaternion.identity) as GameObject;
                        newNewLoot2.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, false);
                        NewLoot newLootControl2 = newNewLoot2.GetComponent <NewLoot>();
                        newLootControl2.value = lootValue;
                        loot            = Loot.Nothing;
                        lootSource.clip = lootSound;
                        lootSource.Play();
                    }
                    GroundSound(ground);
                }
            }
            if (ypos > 10)
            {
                DestroyGameObject();
            }
        }
        else
        {
        }
    }
Example #19
0
    IEnumerator Start()
    {
        transform.name = "playerMe";
        hm             = transform.parent.parent.GetComponent <MoveCharacter>();
        WorldView      = transform.parent.parent;
        player         = hm.transform.GetComponent <Health>();
        cc             = hm.transform.GetComponent <CharacterControl>();

        while (!cc.Intialized)
        {
            yield return(new WaitForSeconds(Time.deltaTime));
        }
        id = cc.player_id;
    }
Example #20
0
    void Start()
    {
        player     = GameObject.FindWithTag("Player").transform;
        agent      = GetComponent <NavMeshAgent>();
        statusBoss = GetComponent <Status>();
        animBoss   = GetComponent <AnimCharacter>();
        moveBoss   = GetComponent <MoveCharacter>();

        scriptUI = GameObject.FindObjectOfType(typeof(UIControl)) as UIControl;

        agent.speed = statusBoss.speed;

        sliderHPBoss.maxValue = statusBoss.Totalhealth;
        AtualizaInterface();
    }
Example #21
0
 void Start()
 {
     anim   = GetComponent <Animator>();
     idle   = true;
     attack = GetComponentInChildren <Attack>();
     // maxHealth = inventory.health;
     //maxMana = inventory.mana;
     //defense = inventory.strength;
     //FindObjectOfType<GameManager>().Load();
     FindObjectOfType <UIManager>().UpdateUI();
     inventory = GameManager.inventory;
     move      = GetComponent <MoveCharacter>();
     //Debug.Log("start Fight" + inventory.playerPosX);
     SetPlayer();
 }
Example #22
0
    bool attackable(Transform chess)
    {
        MoveCharacter mc   = transform.GetComponent <MoveCharacter>();
        bool          able = false;

        if (!mc.MoveMode)
        {
            AttackCalculation atc = new AttackCalculation(chess);
            able = (atc.GetAttableTarget(atc.Attacker).Count > 0);
        }
        else
        {
            able = false;
        }
        return(able);
    }
Example #23
0
    // Use this for initialization
    void Start()
    {
        Title.transform.position = new Vector3(0.2f, 6f, 0);
        GameStartFlag            = false;
        House      = gameObject.transform.Find("HouseImage");
        HouseImage = House.GetComponent <Image>();
        mc         = Player.GetComponent <MoveCharacter>();
        mc.enabled = false;
        tmPro      = Text.GetComponent <TextMeshProUGUI>();
        material   = tmPro.fontMaterial;
        th         = Text.GetComponent <TextHighlight>();
        TextRect   = Text.GetComponent <RectTransform>();
        sources    = gameObject.GetComponents <AudioSource>();

        //Debug.Log("STart");
    }
Example #24
0
        public void Update(MoveCharacter moveCharacter, MovementAction movementAction, Vector3 targetPosition, float rotation, float maxSteering, float maxVelocity, float seperationDistance)
        {
            if (movementAction == MovementAction.DirectMove)
            {
                moveCharacter?.Invoke(targetPosition);
                return;
            }

            // adjust max steering based on time passed since last Update() call
            float timedelta             = (float)(DateTime.UtcNow - LastUpdate).TotalSeconds;
            float maxSteeringNormalized = maxSteering * timedelta;

            Vector3 totalforce = GetForce(movementAction, targetPosition, rotation, maxSteeringNormalized, maxVelocity, seperationDistance);

            Velocity += totalforce;
            Velocity.Truncate(maxVelocity);

            moveCharacter?.Invoke(Bot.Player.Position + Velocity);
            LastUpdate = DateTime.UtcNow;
        }
Example #25
0
        static PureSettei()
        {
            gameRule = GameRule.DobutuShogi;
            // デフォルトでは、どうぶつしょうぎの 3x4 サイズ
            banYokoHaba    = 3;
            banYokoHabaOld = 0;
            banTateHaba    = 4;
            banTateHabaOld = 0;
            name_playerN   = new string[] { "対局者1", "対局者2" };
            random         = new Random();

//#if DEBUG
//            ittedumeTukau = false;
//#else
            ittedumeTukau = true;
//#endif

            char_playerN = new MoveCharacter[] { MoveCharacter.HyokatiYusen, MoveCharacter.HyokatiYusen };
            p1Com        = false;
            p2Com        = false;
        }
Example #26
0
    bool MoveCommand(Transform chess)
    {
        bool              moveable      = false;
        CharacterSelect   chessSelect   = chess.GetComponent <CharacterSelect>();
        CharacterProperty chessProperty = chess.GetComponent <CharacterProperty>();
        Transform         localUnit     = chessSelect.getMapPosition();
        IList             pathList      = new List <Transform>();
        Transform         sel           = decisions.GetMoveTarget(chess);

        if (sel != null)
        {
            pathList = chessSelect.FindPathList(localUnit, CurrentSel.GetSteps(localUnit, sel), sel);
            MoveCharacter mc = Camera.main.GetComponent <MoveCharacter>();
            mc.SetSteps(chess, pathList);
            chessProperty.Moved = true;
            moveable            = true;
        }
        else
        {
            moveable = false;
        }
        return(moveable);
    }
Example #27
0
        public Optionlist()
        {
            AspirationFukasa = 7;
            AspirationWindow = Hyokati.Hyokati_SeiNoSu_Hiyoko;

            BanTateHabaOld = 0;
            BanYokoHabaOld = 0;
            BanTateHaba    = 4;
            BanYokoHaba    = 3;

            BetaCutPer = 100;
            HanpukuSinkaTansakuTukau = true;
            JohoJikan               = 3000;
            JosekiPer               = 50;
            JosekiRec               = false;// 定跡は記録しない
            Learn                   = false;
            NikomaHyokaKeisu        = 1.0d;
            NikomaGakusyuKeisu      = 0.001d;// HYOKA_SCALEが 1.0d のとき、GAKUSYU_SCALE 0.00001d なら、小数点部を広く使って じっくりしている☆(^~^)
            P1Com                   = false;
            P2Com                   = false;
            PNChar                  = new MoveCharacter[] { MoveCharacter.HyokatiYusen, MoveCharacter.HyokatiYusen };
            PNName                  = new string[] { "対局者1", "対局者2" };
            RandomCharacter         = false;
            RandomNikoma            = false;
            RandomStart             = false;
            RenzokuTaikyoku         = false;
            SagareruHiyoko          = false;
            SaidaiEda               = -1;    // 負数なら未指定☆
            SaidaiFukasa            = 1;
            SeisekiRec              = false; // 成績は記録しない
            SennititeKaihi          = false;
            SikoJikan               = 500;
            SikoJikanRandom         = 500;
            TranspositionTableTukau = true;
            UseTimeOver             = true;
        }
Example #28
0
    // Update is called once per frame
    void Update()
    {
        float angle = 0;
        bool  player_stand;             //是否站在能够旋转的方块上
        bool  player_stand_this;        //所站位置是否为当前方块

        GameObject    player = GameObject.Find("Player");
        MoveCharacter script = player.GetComponent("MoveCharacter") as MoveCharacter;

        player_stand      = (script.StandingFloor.GetComponent("Rotating") != null);
        player_stand_this = (script.StandingFloor == gameObject);

        if (!playerRot && player_stand)
        {
            return;                                             //判断playerRot能够允许旋转,能,旋转;不能,不旋转不能动;
        }
        //一下代码的前提都是playerRot能够允许旋转

        if (Input.GetKey(KeyCode.Q))
        {
            angle = -Time.deltaTime * 128;
        }
        else if (Input.GetKey(KeyCode.W))
        {
            angle = Time.deltaTime * 128;
        }
        else
        {
            float dst = Mathf.Floor((m_Angle + 45) / 90) * 90;
            angle = dst - m_Angle;
            if (Mathf.Abs(angle) > 1)
            {
                angle *= 0.125f;
            }
            //Debug.Log(angle);
            if (rotating && angle == 0)
            {
                rotating = false;
                Vector3 pos = transform.position;
                transform.position = new Vector3(Mathf.Round(pos.x), Mathf.Round(pos.y), Mathf.Round(pos.z));
                if (player_stand_this)
                {
                    script.RecalcPlayerPos();
                }
            }
        }

        m_Angle += angle;
        while (m_Angle > 360)
        {
            m_Angle -= 360;
        }
        while (m_Angle < 0)
        {
            m_Angle += 360;
        }

        transform.RotateAround(point, axis, angle);

        if (angle != 0)
        {
            rotating = true;

            script.StopMoving();
            if (!player_stand)
            {
                script.RecalcPlayerPos();                       //如果没有站在能够旋转的方格上就   重置player的位置
            }
            if (player_stand_this)                              //如果站在当前的方块上,包括player一起旋转
            {
                player.transform.RotateAround(point, axis, angle);
            }
        }
    }
Example #29
0
 // Use this for initialization
 void Start()
 {
     transform.name = "playerMe";
     hm             = transform.parent.GetComponent <MoveCharacter>();
     WorldView      = hm.transform.parent;
 }
Example #30
0
 private void Start()
 {
     mc = GetComponent <MoveCharacter>();
 }
Example #31
0
    void Update()
    {
        if (selected)
        {
            GetComponent <Renderer>().material.color = Color.cyan;

            float angle = 0;
            bool  player_stand;
            bool  player_stand_this;

            GameObject    player = GameObject.Find("Player");
            MoveCharacter script = player.GetComponent("MoveCharacter") as MoveCharacter;
            player_stand      = (script.StandingFloor.GetComponent("Rotating") != null);
            player_stand_this = (script.StandingFloor == gameObject);

            if (!playerRot && player_stand)
            {
                return;
            }

            if (Input.GetKey(KeyCode.Q))
            {
                angle = -Time.deltaTime * 128;
            }
            else if (Input.GetKey(KeyCode.W))
            {
                angle = Time.deltaTime * 128;
            }
            else
            {
                // 修正旋转的位置
                float dst = Mathf.Floor((m_Angle + 45) / 90) * 90;
                angle = dst - m_Angle;
                if (Mathf.Abs(angle) > 1)
                {
                    angle *= 0.125f;
                }
                if (rotating && angle == 0)
                {
                    rotating = false;
                    Vector3 pos = transform.position;
                    transform.position = new Vector3(Mathf.Round(pos.x), Mathf.Round(pos.y), Mathf.Round(pos.z));
                    if (player_stand_this)
                    {
                        script.RecalcPlayerPos();
                    }
                }
            }

            m_Angle += angle;
            while (m_Angle > 360)
            {
                m_Angle -= 360;
            }
            while (m_Angle < 0)
            {
                m_Angle += 360;
            }


            // 判断玩家位置是否重叠(还没实现)


            transform.RotateAround(point, axis, angle);

            if (angle != 0)
            {
                rotating = true;

                script.StopMoving();
                if (!player_stand)
                {
                    script.RecalcPlayerPos();
                }

                if (player_stand_this)
                {
                    player.transform.RotateAround(point, axis, angle);
                }
            }
        }
        else
        {
            GetComponent <Renderer>().material.color = Color.grey;
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     thePlayer = FindObjectOfType <MoveCharacter>();
 }