Exemplo n.º 1
0
 void Awake()
 {
     //mouse_look_script = GetComponent<SmoothMouseLook>();
     mouse_look_script = (SmoothMouseLook)GameObject.Find("cameraTarget_GRP").GetComponent<SmoothMouseLook>();
     character_control_script = (CharacterControl)GameObject.Find("character_GRP").GetComponent<CharacterControl> ();
     item_database = gameObject.GetComponent<ItemDatabase>();
 }
Exemplo n.º 2
0
	// Use this for initialization
	void Start () {
		lv = PlayerPrefs.GetInt("LV_Rocket");
		if(lv == 0)
			time = 8;
		else if(lv == 1)
			time = 10;
		else if(lv == 2)
			time = 14;
		else if(lv == 3)
			time = 18;
		else
			time = 24;
		//////////////////////////////////////////////////
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		gc.Rocket = true;
		gp.checkrungame = false;
		speed = gc.speedControl;
		if(GameObject.Find("CharacterControl") != null) {
			_character = GameObject.Find("CharacterControl");
			_character.transform.name = "CC";
			Debug.Log("CharacterControl");
		}else
			_character = GameObject.Find("CC");
		cc = _character.GetComponent<CharacterControl>();
		pos.x = gc.stopCharacterX+2;
		pos.y = -3.5F;
		pos.z = -2;

		posY.z = -2;
	}
Exemplo n.º 3
0
	// Use this for initialization
	void Start () {
		if(GameObject.Find("CharacterControl") != null)
			character = GameObject.Find("CharacterControl");
		else
			character = GameObject.Find("CC");
		cc = character.GetComponent<CharacterControl>();
	}
Exemplo n.º 4
0
    /// <summary>
    /// 圖片設置
    /// </summary>
    /// <param name="name"></param>
    public void SetPlayerImage(string[] name, CharacterControl control) {
        if (skillUseOB == null)
            skillUseOB = transform.FindChild("SkillUse").gameObject;

        // 技能圖片
        for (int i = 0; i < name.Length - 1; i++)
        {
            // 如果技能為空,則關閉技能物件
            if (name[i].Equals(""))
            {
                skillUseOB.transform.GetChild(i).gameObject.SetActive(false);

                transform.FindChild("SkillSelect").GetChild(i).gameObject
                    .SetActive(false);
                continue;
            }

            // 技能物件給予圖片
            skillUseOB.transform.GetChild(i).GetChild(0).gameObject
                .GetComponent<Image>().sprite = Resources.Load<Sprite>
                ("Image/Skill/" + name[i]);
        }

        // 人物圖案
        transform.FindChild("Player").GetComponent<Image>().sprite =
            Resources.Load<Sprite>("Image/Character/" + name[4]);

        this.control = control;
    }
Exemplo n.º 5
0
	public void StartEvent(float x, float y) {
		character = GameObject.Find("CharacterControl").GetComponent("CharacterControl") as CharacterControl;
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		gameControl.eventRun = true;
		eventObject = Instantiate(Ice,new Vector3(x, y, -2F),Quaternion.Euler(0f,0f,0f)) as GameObject;
		step = 1;
	}
Exemplo n.º 6
0
    // front checker
    bool CheckFront(CharacterControl control)
    {
        foreach (GameObject o in control.FrontSpheres)
        {
            Debug.DrawRay(o.transform.position, control.transform.right * 0.3f, Color.yellow);
            RaycastHit hit;
            if (Physics.Raycast(o.transform.position, control.transform.right, out hit, BlockDistance))
            {
            }
        }

        return(false);
    }
Exemplo n.º 7
0
    public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
    {
        CharacterControl control = characterState.GetCharacterControl(animator);

        if (control.MoveLeft || control.MoveRight)
        {
            animator.SetBool(TransitionParameters.Move.ToString(), true);
        }
        else
        {
            animator.SetBool(TransitionParameters.Move.ToString(), false);
        }
    }
Exemplo n.º 8
0
    private bool MakeTransition(CharacterControl control)
    {
        foreach (TransitionConditionType tc in transitionConditions)
        {
            switch (tc)
            {
            case TransitionConditionType.UP:
                if (!control.isMovingForward)
                {
                    return(false);
                }
                break;

            case TransitionConditionType.DOWN:
                if (!control.isMovingBackward)
                {
                    return(false);
                }
                break;

            case TransitionConditionType.LEFT:
                if (!control.isMovingLeft)
                {
                    return(false);
                }
                break;

            case TransitionConditionType.RIGHT:
                if (!control.isMovingRight)
                {
                    return(false);
                }
                break;

            case TransitionConditionType.JUMP:
                if (!control.isJumping)
                {
                    return(false);
                }
                break;

            case TransitionConditionType.GRABBING_LEDGE:
                if (!control.ledgeChecker.isGrabbingLedge)
                {
                    return(false);
                }
                break;
            }
        }
        return(true);
    }
Exemplo n.º 9
0
 private void CheckTurn(CharacterControl control)
 {
     if (!LockDirection)
     {
         if (control.MoveRight)
         {
             control.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
         }
         if (control.MoveLeft)
         {
             control.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
         }
     }
 }
Exemplo n.º 10
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        this.characterNumber = -1;
    }
Exemplo n.º 11
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;
    }
Exemplo n.º 12
0
    public void OnCollisionEnter(Collision col)
    {
        CharacterControl other = col.gameObject.GetComponent <CharacterControl>();

        if (other != null && other.Grounded && controlled)
        {
            transform.position = other.transform.position + (Vector3.right * sphereCollider.radius * 2);
            SetCharacter(true);
        }
        else if (Physics.Raycast(transform.position, Vector3.down, sphereCollider.radius + 0.1f, groundLayer))
        {
            Grounded = true;
        }
    }
Exemplo n.º 13
0
    public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
    {
        CharacterControl control = characterState.GetCharacterControl(animator);

        control.GravityMultiplier = Gravity.Evaluate(stateInfo.normalizedTime);
        control.PullMultiplier    = Pull.Evaluate(stateInfo.normalizedTime);
        CheckExtraJumps(characterState, animator, stateInfo);
        control.animationProgress.Jumped = true;

        if (control.Attack)
        {
            animator.SetBool(TransitionParameter.RangedAttack.ToString(), true);
        }
    }
Exemplo n.º 14
0
    public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
    {
        CharacterControl control = characterState.GetCharacterControl(animator);

        if (control.Attack)
        {
            animator.SetBool(TransitionParameter.Attack.ToString(), true);
        }

        if (control.RangedAttack)
        {
            animator.SetBool(TransitionParameter.RangedAttack.ToString(), true);
        }
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        {
            DrawDefaultInspector();

            CharacterControl control = (CharacterControl)target;

            if (GUILayout.Button("Setup RagdollParts (BodyParts)"))
            {
                control.SetRagdollParts();
            }
        }
    }
Exemplo n.º 16
0
    private void Awake()
    {
        timer        = GameObject.Find("Timer").GetComponent <Text>();
        finalTimer   = GameObject.Find("FinalTimer").GetComponent <Text>();
        panel        = GameObject.Find("Panel").GetComponent <Image>();
        player       = GetComponent <CharacterControl>();
        title        = GameObject.Find("Title").GetComponent <Image>();
        startGame    = GameObject.Find("StartGame").GetComponent <Text>();
        orbCount     = GameObject.Find("OrbCount").GetComponent <Text>();
        map          = GameObject.Find("Main Camera").GetComponent <DrawMap>();
        instructions = GameObject.Find("Instructions");

        UpdateOrbText();
    }
Exemplo n.º 17
0
        protected override async Task ExecuteOnTarget(CharacterControl t)
        {
            await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.CombatStart, CharacterType.Bard,
                                                                  CharacterType.None, CombatManager.Instance.bard.instruments[1].sprite, "Theodore");

            await t.Heal(10);

            await CombatManager.Instance.dialogManager.ShowDialog(DialogFilter.Heal,
                                                                  CharacterType.None, Dialog.GetCharacterTypeFromCharacterControl(t),
                                                                  t.characterData.clientImage, t.characterName);

            // Heal Poison, Confused, Destabilised
            Debug.Log("Annule tous les changements de stats de: " + t.name);
        }
Exemplo n.º 18
0
    public void RegisterAttack(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
    {
        CharacterControl control = characterState.GetCharacterControl(animator);

        if (startAttackTime <= stateInfo.normalizedTime && endAttackTime > stateInfo.normalizedTime)
        {
            foreach (AttackInfo info in AttackManager.Instance.currentAttacks)
            {
                if (info == null)
                {
                    Debug.Log("Register" + info + " is null");
                    continue;
                }

                if (!info.isRegistered && info.attackAbility == this)
                {
                    info.RegisterAttack(this);

                    if (isPunch)
                    {
                        while (startAttackTime <= stateInfo.normalizedTime && endAttackTime > stateInfo.normalizedTime)
                        {
                            for (float t = 0; t <= startAttackTime; t += Time.deltaTime)
                            {
                                control.l_punchBox.SetActive(true);
                            }
                            break;
                        }
                    }

                    if (isKick)
                    {
                        while (startAttackTime <= stateInfo.normalizedTime && endAttackTime > stateInfo.normalizedTime)
                        {
                            for (float t = 0; t <= startAttackTime; t += Time.deltaTime)
                            {
                                control.l_kickBox.SetActive(true);
                            }
                            break;
                        }
                    }

                    if (debug)
                    {
                        Debug.Log(name + " registered: " + stateInfo.normalizedTime);
                    }
                }
            }
        }
    }
Exemplo n.º 19
0
    IEnumerator Start()
    {
        realMe  = transform.parent;
        cc      = realMe.GetComponent <CharacterControl>();
        cc.path = this;
        mp      = GetComponent <GetMovPoint>();

        while (Grid_creator.instance == null || !Grid_creator.instance.Loaded)
        {
            yield return(new WaitForSeconds(0.2f));
        }
        StartCoroutine(UpdatePath());
        StartCoroutine(CheckIfStuck());
    }
Exemplo n.º 20
0
    private void Start()
    {
        // mozna zmienic na enum
        if (gameObject.tag == "Player")
        {
            opponentTag = "Enemy";
        }
        else
        {
            opponentTag = "Player";
        }

        combat     = GetComponent <CharacterCombat>();
        controller = GetComponent <CharacterControl>();
    }
Exemplo n.º 21
0
 public void TakeDamage(float amount, CharacterControl hitBy)
 {
     if (!isServer)
     {
         return;
     }
     Health -= amount;
     if (Health <= 0)
     {
         Health = 0;
         Deaths++;
         hitBy.Kills++;
         RpcKillPlayer(netId, hitBy.netId);
     }
 }
Exemplo n.º 22
0
    // Start is called before the first frame update
    void Start()
    {
        currentControllerState = ControllerState.Player;
        var playerManager = GameObject.FindGameObjectsWithTag("PlayerManager")[0];

        playerCharacterControl =
            playerManager.GetComponent <CharacterControl>();
        playerCameraController =
            playerCamera.GetComponent <PlayerCamMovement>();
        unitCameraController =
            unitCamera.GetComponent <UnitCamMovement>();
        unitCamera.enabled   = false;
        playerCamera.enabled = true;
        playerGun            = playerManager.transform.GetComponentInChildren <Gun>();
    }
Exemplo n.º 23
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            Destroy(other.gameObject);

            CharacterControl.PlayerDied();

            if (CharacterControl.PlayersAlive == 1)
            {
                UnityEditor.EditorApplication.isPlaying = false;
                Application.Quit();
            }
        }
    }
Exemplo n.º 24
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            characterControl = characterState.GetCharacterControl(animator);
            animator.SetBool(TransitionParameter.Attack.ToString(), false);

            GameObject obj  = Instantiate(Resources.Load("AttackInfo", typeof(GameObject))) as GameObject;
            AttackInfo info = obj.GetComponent <AttackInfo>();

            info.ResetInfo(this);

            if (!AttackManager.Instance.currentAttacks.Contains(info))
            {
                AttackManager.Instance.currentAttacks.Add(info);
            }
        }
Exemplo n.º 25
0
    void Start()
    {
        Dist = Vector2.zero;
        mc   = GetComponent <MoveCharacter>();
        cc   = GetComponent <CharacterControl>();

        cc.IsMine = false;

        run = RunAway();
        //StartCoroutine(run);
        item  = GetComponent <AddItem>();
        stats = item.stats;

        AI.Add(GetComponent <Health>());
    }
Exemplo n.º 26
0
 protected override async Task ExecuteOnTarget(CharacterControl t)
 {
     if (t.HasEffect(EffectType.Poison))
     {
         await t.statusEffects.First(e => e.type == EffectType.Poison).RemoveEffect();
     }
     if (t.HasEffect(EffectType.Confused))
     {
         await t.statusEffects.First(e => e.type == EffectType.Confused).RemoveEffect();
     }
     if (t.HasEffect(EffectType.Destabilized))
     {
         await t.statusEffects.First(e => e.type == EffectType.Destabilized).RemoveEffect();
     }
 }
Exemplo n.º 27
0
    void OnTriggerStay2D(Collider2D other)
    {
        GameObject ogo = other.gameObject;

        switch (ogo.tag)
        {
        case "Player":
            CharacterControl cc = GetComponent <CharacterControl>();
            if (cc)
            {
                cc.Damaged();
            }
            break;
        }
    }
Exemplo n.º 28
0
    private bool IsGrabbable(CharacterControl control)
    {
        foreach (GameObject o in control.collisionSpheres.frontSpheres)
        {
            if (Physics.Raycast(o.transform.position, o.transform.right, out RaycastHit hit, distance))
            {
                this.hit     = hit;
                control.grab = true;
                return(true);
            }
        }

        control.grab = false;
        return(false);
    }
Exemplo n.º 29
0
    private void AddSubscription(List <IDisposable> subscriptions, Bard.Bard bard, CharacterControl character, Melody melody)
    {
        subscriptions.Add(
            character.gameObject.OnMouseDownAsObservable()
            .Subscribe(__ => {
            bard.SelectMelody(melody, character);
            subscriptions.ForEach(s => s.Dispose());

            foreach (CharacterControl chara
                     in CombatManager.Instance.teams.SelectMany(team => team))
            {
                chara.gameObject.transform.Find("HighLight").gameObject.SetActive(false);
            }
        }));
    }
 private void OnTriggerStay(Collider other)
 {
     if (m_Player != null)
     {
         m_UITexture.SetActive(true);
         if (m_Player.IsInteractPressed)
         {
             m_IsPlatformActivated = true;
         }
     }
     else
     {
         m_Player = other.gameObject.GetComponent <CharacterControl>();
     }
 }
Exemplo n.º 31
0
	// Use this for initialization
	void Start () {
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		speed = gc.speedControl;
		if(GameObject.Find("CharacterControl") != null) {
			_character = GameObject.Find("CharacterControl");
			_character.transform.name = "CC";
		}else
			_character = GameObject.Find("CC");
		cc = _character.GetComponent<CharacterControl>();
		pos.x = gc.stopCharacterX+1.5F;
		pos.y = -3.5F;
		pos.z = -2;
		
		posY.z = -2;
	}
Exemplo n.º 32
0
 private void Update()
 {
     if (!StartEnter)
     {
         return;
     }
     StayTime += Time.deltaTime;
     if (StayTime > MaxTime)
     {
         ExitMask.Instance.StartExit("BossRoom");
         CharacterControl player = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterControl>();
         player.OnSave();
         Destroy(gameObject);
     }
 }
Exemplo n.º 33
0
        public void SetCharacter(CharacterControl character)
        {
            if (isCustomizing)
            {
                return;
            }
            UI.ToggleActive(true);
            // isCurrPlayer = character == Characters.I.Player.cc;
            isCustomizing = true;
            // mannequinAnim.gameObject.SetActive(true);
            var mannequin = Instantiate(mannequinPrefab);

            mannequin.transform.position = new Vector3(0, 1000f, 0);
            this.mannequin = mannequin.GetComponentInChildren <CharacterControl>();

            var cc = GetCharacterCustomize(character.character.name);

            if (cc == null)
            {
                // Debug.Log("Creating new customization profile");
                cc = new CharacterCustomizeOptions();
                cc.characterName = character.character.name;

                for (int i = 0; i < itemLibraries.Length; ++i)
                {
                    var option = new CustomizeItemOption();
                    option.optionType = itemLibraries[i].optionType;
                    option.library    = itemLibraries[i];
                    cc.options.Add(option);

                    var charEquip = character.charEquip.GetSlotFromTag(itemLibraries[i].optionType);
                    if (charEquip == null || !charEquip.item)
                    {
                        continue;
                    }
                    option.itemName = charEquip.item.name;
                    itemLibraries[i].tempItemInd = GetItemIndex(charEquip.item);
                }
            }

            cc.charCtrl       = character;
            currCharCustomize = cc;
            LoadCharacterCustomizations(this.mannequin);

            UI.SetupOptions(currCharCustomize);
            this.mannequin.charAnim.TogglePoseMode(true);
            Cams.I.SetCamTarget(this.mannequin.gameObject);
        }
Exemplo n.º 34
0
    public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
    {
        CharacterControl charControl = characterState.GetCharacterControl(animator);

        if (stateInfo.normalizedTime >= checkTime)
        {
            if (IsGrounded(charControl))
            {
                animator.SetBool("grounded", true);
            }
            else
            {
                animator.SetBool("grounded", false);
            }
        }
    }
Exemplo n.º 35
0
    // Use this for initialization
    void Start()
    {
        controlScript         = player.GetComponent <CharacterControl>();
        controlScript.enabled = false;

        AudioSource[] sounds = GetComponents <AudioSource>();
        ready = sounds[0];
        set   = sounds[1];
        go    = sounds[2];
        bgm   = sounds[3];

        ready.Play();
        set.PlayDelayed(1f);
        go.PlayDelayed(2f);
        bgm.PlayDelayed(3f);
    }
Exemplo n.º 36
0
        public new async Task Execute(CharacterControl s)
        {
            CharacterControl target = RandomTargetInTeam(s.team + 1);

            if (hasForcedTarget)
            {
                target = forcedTarget;
            }

            await target.TakeDamage(0.2f *s.currentStats.atq);

            foreach (var buff in target.statusEffects.Where(e => e.type == EffectType.Buff && ((Buff)e)._modifier > 0))
            {
                await((Buff)buff).RemoveEffect();
            }
        }
    // Update is called once per frame
    void OnTriggerEnter(Collider other)
    {
        //Debug.Log("TRIGGERED");
        if (other.tag == "Player")
        {

            if (!playerController)
            {
                playerController = GameObject.FindGameObjectWithTag("Player").GetComponent<CharacterControl>();
            }
            Vector3 vel = playerController._velocity;

            Debug.Log("vel: " + vel);

            if (vel.y < -0.05f)
            {
                float scale = Mathf.Min(Mathf.Abs(vel.y), maxSpeed); //Velocity scale doesn't work yet with new character controller
                //float scale = 5f;
                Debug.Log("CREATESPLASH; scale: " + scale);
                CreateSplash(scale, other.transform.position);
            }
        }
    }
Exemplo n.º 38
0
 IEnumerator crSetReferences()
 {
     yield return null;
     abc = GameObject.FindGameObjectWithTag("Player").GetComponent<CharacterControl>();
 }
Exemplo n.º 39
0
	// Use this for initialization
	void Start () {
		character	= gameObject.GetComponent<CharacterControl>();
		gameControl = GameObject.Find("GameControl").GetComponent<GameControl>();
		gamePlay	= GameObject.Find("GameControl").GetComponent<GamePlay>();
		cc			= GameObject.Find("Main Camera");
	}
Exemplo n.º 40
0
    void Start()
    {
        //anim = GetComponent<Animator>();
        player = GetComponent<CharacterControl> ();
        health = startHealth;
        //Der Level-Index muss dem Spiel entsprechend angepasst werden, wenn es z.B. eine begrüßungsszene gibt (oder ein Hauptmenü)
        if (Application.loadedLevel == 0) {

            UpdateView();
        }
    }
Exemplo n.º 41
0
 // Use this for initialization
 void Start()
 {
     characterControl = FindObjectOfType<CharacterControl>();
 }
Exemplo n.º 42
0
    void AddAObj(CharacterControl characterControll, bool isadd = true)
    {
        if (isadd)
        {
            // adjust attack value in case zero effect buff is on.
            characterControll.AdjustAttackValue();
            characterControll.ShowAttack(true, TeamController.SelectedCharacterList.Count - 1);
            selectEffectList.Add(EffectManager.ShowEffect(EffectType.SelectEffects[currentFootIndex], 0, 0, characterControll.transform.position));
        }
        else
        {
            characterControll.ShowAttack(false);
            Destroy(selectEffectList[selectEffectList.Count - 1] as GameObject);
            selectEffectList.RemoveAt(selectEffectList.Count - 1);
        }

        characterAttackValue = isadd ? characterAttackValue + characterControll.AttackValue : characterAttackValue - characterControll.AttackValue;
        FaceController.SetAttackLabel("" + characterAttackValue);

        if (currentFootIndex == (int)FootColorType.Pink)
        {
            hpController.ShowBackgroundBar(characterAttackValue);
        }
        hpController.ShowBackgroundBar(TeamController.SelectedCharacterList.Count);
    }
Exemplo n.º 43
0
	// Use this for initialization
	void Start () {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		cha = GameObject.Find("CharacterControl").GetComponent<CharacterControl>();
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
	}
Exemplo n.º 44
0
    // Use this for initialization
	void Start ()
    {
        player = gameObject.GetComponentInParent<CharacterControl>();
	}
Exemplo n.º 45
0
 // Use this for initialization
 void Start()
 {
     //hc = GetComponent<HealthController> ();
     cc = GetComponent<CharacterController> ();
     auchCC = GetComponent<CharacterControl> ();
 }