コード例 #1
0
    void Start()
    {
        anim             = GetComponent <Animator>();
        myBody           = GetComponent <Rigidbody2D>();
        InteractionModel = GetComponent <CharacterInteractionModel>();
        HideWeapon();
        audio             = gameObject.AddComponent <AudioSource>();
        audio.playOnAwake = false;
        audio.volume      = 0.8f;
        attackSounds      = Resources.LoadAll("Sounds/AttacksBis");
        pointsSound       = Resources.LoadAll("Sounds/Coins");
        hurtSound         = Resources.Load("Sounds/Hurt");
        shootSounds       = Resources.LoadAll("Sounds/Shoot");
        heartSound        = Resources.Load("Sounds/heart");
        wrongSound        = Resources.Load("Sounds/wrong");
        setFrozen(false, true);

        GlobalBehavior global = GameObject.FindGameObjectWithTag("Global").GetComponent <GlobalBehavior> ();

        if (SceneManager.GetActiveScene().name == "Level1")
        {
            global.initValue();
        }

        maxHp     = global.maxHpPlayer;
        damage    = global.damagePlayer;
        moveSpeed = global.moveSpeedPlayer;
        InitPoint(global.scorePlayer);
        Debug.Log(maxHp);
        Debug.Log(damage);
        Debug.Log(moveSpeed);

        currentHp = maxHp;
        UpdateDisplayHearts();
    }
コード例 #2
0
 //Init all systems by finding their gamecomponent
 private void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_MovementView     = GetComponent <CharacterMovementView>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_BombModel        = GetComponent <CharacterBombModel>();
 }
コード例 #3
0
 void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_MovementView     = GetComponent <CharacterMovementView>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_pocketModel      = GetComponent <CharacterPocketModel>();
 }
コード例 #4
0
    void UnregisterInteractable()
    {
        CharacterInteractionModel characterInteractionModel = GetCharacterInteractionModel();

        if (characterInteractionModel == null)
        {
            return;
        }
        characterInteractionModel.RemoveInteractable(this);
    }
    public Inventory m_Inventory; //this is for debugging purposes

    void Awake()
    {
        m_MovementModel    = GetComponent <CharacterMovementModel>();
        m_MovementView     = GetComponent <CharacterMovementView>();
        m_InteractionModel = GetComponent <CharacterInteractionModel>();
        if (gameObject.tag == "Player")
        {
            m_AttackManager = GetComponentInChildren <AttackManager>();
        }
    }
コード例 #6
0
    void Awake()
    {
        character = this;

        m_MovementModel       = MovementModel;
        m_InteractionModel    = InteractionModel;
        m_MovementView        = MovementView;
        m_InventoryModel      = InventoryModel;
        m_AttackableCharacter = AttackableCharacter;
        m_CharacterAudio      = AudioCharacter;
    }
コード例 #7
0
    public override void OnInteract(Character character)
    {
        CharacterInteractionModel interactionModel = character.GetComponent <CharacterInteractionModel>();

        if (interactionModel == null)
        {
            return;
        }

        BroadcastMessage("OnPickUpObject", character, SendMessageOptions.DontRequireReceiver);
        interactionModel.PickUpObject(this);
    }
コード例 #8
0
 void Awake()
 {
     character          = GetComponent <Character>();
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_MovementView     = GetComponent <CharacterMovementView>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_EquipmentModel   = GetComponents <EquipmentBaseModel>();
     holdTimers         = new float[3];
     canUse             = new bool[3] {
         true, true, true
     };
 }
コード例 #9
0
    public override void OnInteract(Character character)
    {
        CharacterInteractionModel interactionModel = character.GetComponent <CharacterInteractionModel>();

        if (interactionModel == null)
        {
            return;
        }

        rb.velocity = Vector3.zero;
        isBeingHeld = true;
        interactionModel.PickupObject(this);
        stopMoving = false;
    }
コード例 #10
0
    private CharacterInteractionModel GetCharacterInteractionModel()
    {
        GameObject playerObject = GameObject.FindWithTag("Player");

        if (playerObject == null)
        {
            Debug.LogWarning("Interactable: playerObject not found");
            return(null);
        }
        CharacterInteractionModel characterInteractionModel = playerObject.GetComponent <CharacterInteractionModel>();

        if (characterInteractionModel == null)
        {
            Debug.LogWarning("Interactable: characterInteractionModel not found");
            return(null);
        }
        return(characterInteractionModel);
    }
コード例 #11
0
    CharacterInteractionModel FindCharacterInteractionModel()
    {
        GameObject playerObject = GameObject.FindGameObjectWithTag("Player");

        if (playerObject == null)
        {
            Debug.LogWarning("No player found");
            return(null);
        }

        CharacterInteractionModel interactionModel = playerObject.GetComponent <CharacterInteractionModel>(); //Here the scripts grabs the interactionmodel of the playable character

        if (interactionModel == null)
        {
            Debug.LogWarning("No interactionmodel found on player");
            return(null);
        }

        return(interactionModel);
    }
コード例 #12
0
    public override void OnInteract(Character character)
    {
        CharacterInteractionModel InteractionModel = character.GetComponent <CharacterInteractionModel>();

        if (InteractionModel == null)
        {
            Debug.LogWarning("No Advanced Movemodel found on Interact!");
            return;
        }

        BroadcastMessage("OnPickupObject", character, SendMessageOptions.DontRequireReceiver);
        character.InteractionModel.PickUpObject(this);
        Collider2D[] colliders = GetComponents <Collider2D>();
        foreach (Collider2D col in colliders)
        {
            if (col.isTrigger == false)
            {
                col.enabled = false;
            }
        }
    }
コード例 #13
0
    public override void OnInteract(Character _character)
    {
        CharacterInteractionModel interactionModel = _character.GetComponent <CharacterInteractionModel>();

        character = _character;


        if (interactionModel == null)
        {
            return;
        }

        if (!isGrabbing)
        {
            interactionModel.GrabObject(this, character);
            isGrabbing = true;
            distance   = Vector3.Distance(character.transform.position, transform.position);
        }
        else
        {
            isGrabbing = false;
        }
    }
コード例 #14
0
 void Awake() 
 {
     m_Model = GetComponent<CharacterInteractionModel>();
 }
コード例 #15
0
 void Awake()
 {
     characterMovementModel    = GetComponent <CharacterMovementModel>();
     characterInteractionModel = GetComponent <CharacterInteractionModel>();
     quantesVegadesEspai       = 0;
 }
コード例 #16
0
 //Init things
 private void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_Collider         = GetComponent <Collider2D>();
 }
コード例 #17
0
 private void Awake()
 {
     MovementModel    = GetComponent <CharacterMovementModel>();
     MovementView     = GetComponent <CharacterMovementView>();
     InteractionModel = GetComponent <CharacterInteractionModel>();
 }
コード例 #18
0
 void Awake()
 {
     m_MovementModel = GetComponent<CharacterMovementModel>();
     m_MovementView = GetComponent<CharacterMovementView>();
     m_InteractionModel = GetComponent<CharacterInteractionModel>();
 }
コード例 #19
0
 void Awake()
 {
     characterMovement  = GetComponent <CharacterMovementModel>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     col = GetComponent <Collider2D>();
 }
 void Awake()
 {
     m_MovementModel = GetComponent<CharacterMovementModel>();
     m_InteractionModel = GetComponent<CharacterInteractionModel>();
     m_Collider = GetComponent<Collider2D>();
 }
コード例 #21
0
 private void Awake()
 {
     m_Model = GetComponent <CharacterInteractionModel>();
 }
コード例 #22
0
 void Awake()
 {
     m_Renderer    = GetComponentInChildren <SpriteRenderer>();
     m_Interaction = GetComponentInParent <CharacterInteractionModel>();
 }
コード例 #23
0
 void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
 }