Inheritance: MonoBehaviour
Exemplo n.º 1
0
    IEnumerator ChapterStart()
    {
        CharacterMover playerMover = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterMover>();

        playerMover.moveType = CharacterMover.MoveType.LOCK;

        StartUI.SetActive(true);

        text = StartUI.GetComponentInChildren <Text>();

        yield return(StartCoroutine(StartTextFadeIn()));

        yield return(new WaitForSeconds(2.0f));

        yield return(StartCoroutine(StartTextFadeOut()));

        StartUI.SetActive(false);

        objFadeEfx.SetActive(true);
        fadeEfx.FadeIn();

        yield return(StartCoroutine(PartnerEvent()));

        playerMover.moveType = CharacterMover.MoveType.COMMANDMOVE;
        note.AddMission("Resque");
        avDoor.enabled = false;
        yield break;
    }
Exemplo n.º 2
0
    public AbstractAction(GameObject actor)
    {
        this.actor = actor;

        state = actor.GetComponent(typeof(CharacterState)) as CharacterState;
        animator = actor.GetComponent(typeof(CharacterAnimator)) as CharacterAnimator;
        mover = actor.GetComponent(typeof(CharacterMover)) as CharacterMover;
        actionRunner = actor.GetComponent(typeof(ActionRunner)) as ActionRunner;

        animationName = null;
        wrapMode = WrapMode.Once;
        emotionBodyParts = Emotion.BodyParts.NONE;

        canStartDialogueWithPC = true;
        canStartDialogueWithAgents = true;
        canEndAnyTime = true;
        //canCancelDuringMovement = true;

        quickReaction = null;
        moveToAction = null;

        started = false;
        endedASAP = false;
        endNextRound = false;

        finished = false;
    }
Exemplo n.º 3
0
    //bool isLooping;

    // Use this for initialization
    void Start()
    {
        //isLooping = false;
        //TopCGPannel = objTopCGPannel.GetComponent<Image>();

        playerMover = FindObjectOfType <CharacterMover>();
    }
    public override void UpdateMotor(CharacterMover mover)
    {
        //variable height
        if (mover.krJump && mover.velocity.y > 0f)
        {
            mover.gravity = new Vector3(0f, mover.gSpeedVariable, 0f);
        }
        if (mover.velocity.y <= 0f)
        {
            //if (mover.wallSlide)
            //	mover.gravity= new Vector3(0f, mover.gSpeed/5, 0f);
            //else
            mover.gravity = new Vector3(0f, mover.gSpeed, 0f);
        }
        mover.velocity += mover.gravity * Time.deltaTime;
        mover.wallSlide = false;

        mover.velocity = mover.Accelerate(mover.accelDir, mover.velocity, mover.airAccel, mover.maxAirSpeed);

        //mover.charController.Move (mover.velocity);
        if (mover.IsGrounded())
        {
            mover.velocity     = new Vector3(mover.velocity.x, 0f, mover.velocity.z);
            mover.currentState = MovementState.walking;
            mover.wallSlide    = false;
            mover.gravity      = new Vector3(0f, mover.gSpeed, 0f);
            Debug.Log("Switch to walking");
        }
    }
Exemplo n.º 5
0
    /**
     * Use this for initialization
     * Disable if we are not the owner of this gameObject
     */
    void Start()
    {
//		if (!(photonView.owner == PhotonNetwork.player) ) {
//			this.enabled = false;
//		}
        mover = GetComponent <CharacterMover>();
    }
    public override void UpdateMotor(CharacterMover mover)
    {
        mover.currentState = MotorState.grappling;

        lr.SetPosition(0, hand.position);
        lr.SetPosition(1, Pivot.transform.position);

        tempVelocity = mover.velocity;

        // If the player is right clicking as they're swinging, retract the rope
        if (Input.GetMouseButton(1))
        {
            ropeLength -= retractSpeed * Time.deltaTime;
        }

        if (boosting = ((boostDelta -= Time.deltaTime) <= 0 && Input.GetKeyDown(KeyCode.Space)))
        {
            boostDelta = boostCooldown;
        }


        ropeLength = Mathf.Clamp(ropeLength, minRopeLength, maxRopeLength);

        currentStatePosition = PendulumUpdate(transform.position, Time.deltaTime, mover);
        tempVelocity         = tempVelocity.magnitude > maxSpeed ? tempVelocity.normalized * maxSpeed : tempVelocity;
        mover.velocity       = tempVelocity;


        UpdateGrappleArrow();


        transform.position = currentStatePosition;
    }
Exemplo n.º 7
0
    // we will need this c# magic for our animation state when its in
    //public bool isMovingTest
    //{
    //    set
    //    {
    //        if (Input.GetAxis("Vertical") == 0 && Input.GetAxis("Horizontal") == 0) { isMoving = false; }
    //        else { isMoving = true; }
    //    }
    //    get { return isMoving; }
    //}


    // Start is called before the first frame update
    void Start()
    {
        charDirection     = this.GetComponent <CharDirection>();
        characterMover    = this.GetComponent <CharacterMover>();
        characterAnimator = this.GetComponent <CharacterAnimator>();
        worldInteracter   = this.GetComponent <WorldInteracter>();
    }
    public override void UpdateMotor(CharacterMover mover)
    {
        //apply Friction
        float speed = mover.velocity.magnitude;

        if (speed != 0)         //avoid dividing by zero
        {
            float drop = speed * mover.friction * Time.deltaTime;
            mover.velocity *= Mathf.Max(speed - drop, 0) / speed;             //scale the velocity based on friction.
        }

        mover.velocity = mover.Accelerate(mover.accelDir, mover.velocity, mover.groundAccel, mover.maxGroundSpeed);

        //jumping
        if (mover.kpJump)
        {
            mover.velocity = new Vector3(mover.velocity.x, mover.jumpSpeed, mover.velocity.z);
            mover.gravity  = new Vector3(0f, mover.gSpeed, 0f);
        }

        //floor no longer beneath us, switch state
        if (!mover.IsGrounded())
        {
            mover.currentState = MovementState.falling;
            Debug.Log("Switch to falling");
        }
    }
    public override void UpdateMotor(CharacterMover mover)
    {
        motorState = MotorState.falling;

        // Move down at the speed of gravity
        mover.velocity += (mover.gravity + mover.inputVector) * Time.deltaTime;
    }
Exemplo n.º 10
0
 private void Awake()
 {
     BPhysicsWorld.Get().AddAction(this);
     characterMover = GetComponent <CharacterMover>();
     inputHandler   = GetComponent <InputHandler>();
     groundChecker  = GetComponent <GroundedChecker>();
 }
    public override void UpdateMotor(CharacterMover mover)
    {
        //apply Friction
        float speed = mover.velocity.magnitude;

        if (speed != 0)         //avoid dividing by zero
        {
            float drop = speed * mover.friction * Time.deltaTime;
            mover.velocity *= Mathf.Max(speed - drop, 0) / speed;             //scale the velocity based on friction.
        }


        mover.velocity += mover.gravity * .2f * Time.deltaTime;

        mover.velocity = mover.Accelerate(mover.accelDir, mover.velocity, mover.groundAccel, mover.maxGroundSpeed);

        //jumping
        if (mover.kpJump)
        {
            mover.velocity += new Vector3(0f, mover.jumpSpeed, 0f);
        }
        //float upwards
        if (mover.kJump)
        {
            mover.velocity += mover.gravity * -.6f * Time.deltaTime;
        }
    }
Exemplo n.º 12
0
    public void InitializeCharacter()
    {
        characterInstance.SetCharClass(this.charClass);
        Debug.Log("Create : " + charClass);

        Tile startTile = TileManager.GetStartTile();

        characterInstance.SetStartTile(startTile);
        characterInstance.SetIsMine(GameManager.gameManagerInstance.isMyCharacterManager(this));
        characterInstance.SetPlayerId(GameManager.GetNetworkViewID(this));

        characterInstance.Initialize();

        Vector3 spawnTilePosition        = characterInstance.GetSpawnTile().gameObject.transform.position;
        Vector3 spawnPositionOfCharacter = new Vector3(spawnTilePosition.x, spawnTilePosition.y, Unit.Depth);

        characterInstance.transform.position = spawnPositionOfCharacter;
        Vector2 characterCoordinate = FieldTileUtility.GetCoordFromPosition(spawnPositionOfCharacter.x, spawnPositionOfCharacter.y);

        CharacterMover mover = characterInstance.GetComponent <CharacterMover>();

        mover.InitializeTileKey((int)(characterCoordinate.x * 100 + characterCoordinate.y));

        Camera.main.transform.position = new Vector3(spawnPositionOfCharacter.x, spawnPositionOfCharacter.y, Camera.main.transform.position.z);
    }
Exemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     // get scripts we need
     charDirection     = this.GetComponent <CharDirection>();
     characterMover    = this.GetComponent <CharacterMover>();
     characterAnimator = this.GetComponent <CharacterAnimator>();
 }
Exemplo n.º 14
0
    // State behaviour
    protected override void LaunchProjectile()
    {
        Collider2D     enemy = Physics2DUtility.FindClosestTarget(user, preset.SearchRange, preset.HitboxLayer.Character);
        CharacterMover mover = user.GetComponent <CharacterMover>(); // TODO: Can cache this if you need to

        // Float
        //user.GetComponent<CharacterCore>().ApplyFloat(floatDuration, floatDuration);

        // Initialise projectile
        Vector2 direction = user.transform.right * preset.ProjectileSpeed;

        if (enemy != null)
        {
            direction = (enemy.transform.position - user.transform.position).normalized * preset.ProjectileSpeed;

            // Change facing direction of user
            if (enemy.transform.position.x > user.transform.position.x) // If enemy is to the right of user, face right
            {
                mover.FaceRight(true);
            }
            else
            {
                mover.FaceRight(false);
            }
        }

        InstantiateProjectile(direction, preset.ProjectileDuration).transform.right = direction;
    }
    public override void UpdateMotor(CharacterMover mover)
    {
        motorState = MotorState.falling;

        // Move down at the speed of gravity
        mover.velocity += gravity;
    }
Exemplo n.º 16
0
 private void Start()
 {
     aiFighter     = GetComponent <Fighter>();
     aiMover       = GetComponent <CharacterMover>();
     health        = GetComponent <Health>();
     guardPosition = transform.position;
     guardRotation = transform.rotation;
 }
Exemplo n.º 17
0
 private void Awake()
 {
     _characterCustomController = GetComponent <CharacterCustomController>();
     _transform     = this.transform;
     characterMover = GetComponent <CharacterMover>();
     SetState(NPCState.Idling);
     StartCoroutine(PoiDelay(poiDelay));
 }
Exemplo n.º 18
0
 private void Start()
 {
     pathfinding            = GetComponent <Pathfinding>();
     turnManager            = GetComponent <TurnManager>();
     combatManager          = GetComponent <CombatManager>();
     combatAnimationManager = GetComponent <CombatAnimationManager>();
     characterMover         = GetComponent <CharacterMover>();
 }
 public override void HandleCollision(CharacterMover mover, ControllerColliderHit hit)
 {
     // Check if the hit was below the player character, otherwise they should keep falling
     if (hit.point.y < transform.position.y - 0.5f)
     {
         mover.currentState = MotorState.walking;
     }
 }
    public void ShowCharacterUpgradePopup(int cardNumber)
    {
        GameObject     card      = cardMovementRef.playerCards [cardNumber];
        CardReferences cardRef   = card.GetComponent <CardReferences> ();
        CharacterMover character = cardRef.character.GetComponent <CharacterMover> ();

        UpgradeController.Instance.ShowCharacterUpgradeDialogue(character, gameRef.upgradeScreenRef);
    }
Exemplo n.º 21
0
 public override void HandleCollision(CharacterMover mover, ControllerColliderHit hit)
 {
     // Falling so that the falling motor will place them back to a proper distance on the ground just in case it's at an awkward angle
     if (hit.gameObject.layer == groundLayer)
     {
         mover.currentState = MotorState.falling;
     }
 }
Exemplo n.º 22
0
    void OnTriggerEnter(Collider other)
    {
        CharacterMover mover = other.gameObject.GetComponent <CharacterMover>();

        if (mover != null)
        {
            mover.Jump();
        }
    }
Exemplo n.º 23
0
    //AudioSource AudioSource;


    private void Start()
    {
        //AudioSource = GetComponent<AudioSource>();
        characterMover   = FindObjectOfType <CharacterMover>();
        monsterControl   = MonsterControl();
        isActive         = true;
        pannelController = new PannelController();
        pannelController.pannelRenderer = objMonsterPannel.GetComponent <SpriteRenderer>();
    }
Exemplo n.º 24
0
    void OnTriggerEnter(Collider other)
    {
        CharacterMover player = other.gameObject.GetComponent <CharacterMover>();

        if (player != null)
        {
            player.SendMessage("Victory");
        }
    }
Exemplo n.º 25
0
 // Use this for initialization
 void Awake()
 {
     mover         = GetComponent <CharacterMover>();
     input         = GetComponent <CharacterInput>();
     light         = GetComponent <CharacterLight>();
     animator      = GetComponent <CharacterAnimator>();
     m_rigidbody2D = GetComponent <Rigidbody2D>();
     m_rigidbody2D.gravityScale = 3.5f;
 }
Exemplo n.º 26
0
    void OnTriggerEnter(Collider other)
    {
        CharacterMover player = other.gameObject.GetComponent <CharacterMover>();

        if (player != null)
        {
            player.Kill();
        }
    }
    private void Awake()
    {
        rb    = GetComponent <Rigidbody>();
        mover = GetComponent <CharacterMover>();

        targetRotation = cam.rotation;

        DetirmineStance();
    }
Exemplo n.º 28
0
 private void Awake()
 {
     cc                  = GetComponent <CharacterMover>();
     player              = GameObject.FindGameObjectWithTag("Player");
     playerRoomHandler   = player.GetComponent <RoomHandler>();
     playerPickupHandler = player.GetComponent <PickupHandler>();
     roomHandler         = GetComponent <RoomHandler>();
     detectTime          = maxDetectTime;
 }
Exemplo n.º 29
0
    public override void UpdateMotor(CharacterMover mover)
    {
        float xVel = 0f;
        float zVel = 0f;

        //Move along x axis
        if ((mover.aInput && mover.dInput) || (!mover.aInput && !mover.dInput))
        {
            xVel = 0;
        }
        else if (mover.aInput)
        {
            xVel = mover.moveSpeed;
        }
        else
        {
            xVel = -mover.moveSpeed;
        }

        //Move along y axis
        if ((mover.wInput && mover.sInput) || (!mover.wInput && !mover.sInput))
        {
            zVel = 0;
        }
        else if (mover.wInput)
        {
            zVel = mover.moveSpeed;
        }
        else
        {
            zVel = -mover.moveSpeed;
        }

        mover.velocity = new Vector3(zVel, mover.velocity.y, xVel);

        //jumping
        if (mover.jInput)
        {
            float yVel = mover.jumpSpeed;
            mover.velocity += new Vector3(0f, yVel, 0f);
        }

        mover.charController.Move(mover.velocity);

        //Check if ground beneath is gone
        RaycastHit rayHit;

        if (Physics.SphereCast(transform.position, mover.radius, Vector3.down, out rayHit, 10f, mover.collisionMask))
        {
            if (rayHit.distance > .5f)
            {
                mover.currentState = MovementState.falling;
                Debug.Log("Switch to falling");
            }
        }
    }
Exemplo n.º 30
0
    // Use this for initialization
    public void Start()
    {
        player         = GameObject.FindGameObjectWithTag("Player");
        playerAnimator = player.GetComponent <Animator>();
        playerMover    = player.GetComponent <CharacterMover>();

        SafeCount = 0;

        note = FindObjectOfType <Note>();
    }
 // Use this for initialization
 void Awake()
 {
     mat = GetComponent <Renderer>().material;
     if (player == null)
     {
         player      = GameObject.FindGameObjectWithTag("Player");
         playerMover = player.GetComponent <CharacterMover>();
         maxDistance = playerMover.GetMaxGrappleDistance();
     }
 }
Exemplo n.º 32
0
    // Use this for initialization
    void Start()
    {
        _mover = gameObject.GetComponent<CharacterMover> ();
        _memory = gameObject.GetComponent<CharacterMemory> ();
        needs = new Dictionary<string, int> ();
        foreach (string need in GameLogic.villagerNeeds) {
            needs.Add (need,100);
        }

        gameObject.name = _memory.Name;
    }
Exemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     _mover = gameObject.GetComponent<CharacterMover> ();
     _memory = gameObject.GetComponent<CharacterMemory> ();
     _interface = gameObject.transform.FindChild ("Canvas").gameObject;
     needs = new Dictionary<string, int> ();
     foreach (string need in GameLogic.villagerNeeds) {
         needs.Add (need, 100);
     }
     gameObject.transform.FindChild ("Name").GetComponent<TextMesh> ().text = _memory.Name;
     gameObject.name = _memory.Name;
 }
Exemplo n.º 34
0
	void Awake (){
		mover = GetComponent<CharacterMover>();
		pause = GameObject.Find("PauseState").GetComponent<PauseState>();
	}
Exemplo n.º 35
0
    protected override void InitializeActor()
    {
        base.InitializeActor();

        world = FindObjectOfType<WorldManager>();
        if(world ==  null) {
            Debug.Log("ERROR!     "+name+" couldn't find the WorldManager on initialization!");
        }

        // Store all anim info to be set in the animator at the end of the frame
        cachedAnimData = new CachedAnimData();
        cachedAnimData.transperency = 1.0f;

        movementComp = GetComponent<CharacterMover>();
        if(movementComp == null) {
            Debug.Log("WARNING!      "+name+" :: Doesn't have a movement component!");
        }

        animator = GetComponent<Animator>();
        if(animator == null) {
            Debug.Log("WARNING!      "+name+" :: Doesn't have an animator!");
        }
        animator.logWarnings = false;

        // Add the blood particle effect at init b/c its so frequently used. The others are added as needed
        if(bDoesConditionEffects && bloodEffectsPrototype != null) {
            bloodEffectSystem = AddEffectAttached(bloodEffectsPrototype, Vector3.zero);
        }

        health = baseHealth;
        cachedAnimData.mirroring = Facing.right;
        bIsDead = false;
        specialMove = SpecialMove.SM_None;

        if(!bCanModifyVisibilty) {
            visibility = MAX_VISIBILITY;
        }

        // Ability sets
        abilities = new List<Ability>();
        abilitiesInUse = new List<Ability>();
        pendingAbilities = new Queue<Ability>();

        // Create the effect heuristic: The effect classes apear in the same order as the effects enum
        activeEffects = new Effect[NUM_EFFECTS];
        activeEffects[(int)EffectType.Burning] = new Effect_HealthDrain(this, EffectType.Burning, 50, 0.3f);
        activeEffects[(int)EffectType.Bleeding] = new Effect_HealthDrain(this, EffectType.Bleeding, 10, 0.5f);
        activeEffects[(int)EffectType.Broken] = new Effect_Broken(this, EffectType.Broken);
        activeEffects[(int)EffectType.Knockdown] = new Effect_Knockdown(this, EffectType.Knockdown);
        activeEffects[(int)EffectType.Dazed] = new Effect_Daze(this, EffectType.Dazed);
        activeEffects[(int)EffectType.Poison] = new Effect_HealthDrain(this, EffectType.Poison, 25, 0.5f);
        activeEffects[(int)EffectType.Blind] = new Effect_Blind(this, EffectType.Blind);

        // One resistance stat for each effect type
        resistances = new float[NUM_EFFECTS];
        for(int i = 0; i < resistances.Length; i++) {
            resistances[i] = 0.0f;
        }

        // Stat Table: starts out 0'd
        //stats = new int[NUM_STATS];
        //for(int i = 0; i < stats.Length; i++) {
        //    stats[i] = 0;
        //}

        inventory = new Inventory(INVENTORY_SIZE);

        // Just set default attack location to be the torso
        attackTargetLocation = BodyPart.Torso;

        nearbyDrops = new List<DroppedItem>();

        // Search all children transforms for the shadow one
        if(transform.childCount > 0) {
            for(int i = 0; i < transform.childCount; i++) {
                if(transform.GetChild(i).GetComponent<SpriteRenderer>()) {
                    shadowTransform = transform.GetChild(i);
                    break;
                }
            }
        }
    }
Exemplo n.º 36
0
 public void SetMainCharacter(CharacterMover mainCharacter)
 {
     MainCharacter = mainCharacter;
 }
Exemplo n.º 37
0
 protected virtual void Start()
 {
     animator = GetComponent<Animator>();
     mover = GetComponent<CharacterMover>();
 }
Exemplo n.º 38
0
    void Start()
    {
        mover = GetComponent<CharacterMover>();
        animator = GetComponent<Animator>();
        skill = GetComponent<CharacterMoveAttack>();
        //singleAttack = GetComponent<CharacterSingleAttack>();
        cameraMove = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraMove>();

        activeTime = ActiveTimeCreater.Instance.CreateActiveTime(this);
        SetActiveTimeEventHandler();
        SetPositionOnTile();
        activeCircle.SetActive(false);
        DisableActionMode();
        CreateCharacterUI();
        //Init();
    }
Exemplo n.º 39
0
 public void SetSelecterCharacter(CharacterMover selectedCharacter)
 {
     currentSelectedCharacter = selectedCharacter;
 }