Exemple #1
0
void ALD35Character::Transform()
{
	if (!IsInAlternateForm && Energy < 0.05f) return;

	if (CanTransform)
	{
		IsInAlternateForm = !IsInAlternateForm;

		if (IsInAlternateForm)
		{
			GetCharacterMovement()->MaxWalkSpeed = 1000;
			GetCharacterMovement()->JumpZVelocity = 900;
		}
		else
		{
			GetCharacterMovement()->MaxWalkSpeed = InitialSpeed;
			GetCharacterMovement()->JumpZVelocity = InitialJumpPower;
		}

		TArray<FOverlapResult> res;

		if (GetWorld()->OverlapMultiByObjectType(res, GetActorLocation(), FQuat::Identity, FCollisionObjectQueryParams::AllDynamicObjects, FCollisionShape::MakeSphere(3000)))
		{
			for (auto& a : res)
			{
				if (auto chr = Cast<ALD35Character>(a.Actor.Get()))
				{
					if (auto con = Cast<AWarriorAIController>(chr->GetController()))
					{
						if (con->CanPawnSee(this))
						{
							UE_LOG(LogTemp, Display, TEXT("%s saw you transform!"), *chr->GetName());

							con->KnowsWeretigerIdentity = true;

							if (FMath::Rand() % 4 == 0)
							{
								UGameplayStatics::PlaySoundAtLocation(this, SeeWereTigerSound, con->GetPawn()->GetActorLocation());
							}
						}
					}
				}
			}
		}

		OnTransform();

		UGameplayStatics::PlaySoundAtLocation(this, TransformSound, GetActorLocation());

		for (TActorIterator<ALD35Character> i(GetWorld()); i; ++i)
		{
			i->IsSomeoneTransformed = IsInAlternateForm;
		}
	}
}
Exemple #2
0
/******************************************************************************
 *  void MenuOnCommand(HMENU hmenu, HWND hwnd)
 * 
 *  frame window WM_COMMAND handler
 *
 *  parameters:
 *      wCmd - menu item id (WM_COMMAND wParam)
 *
 *  returns:
 *      TRUE if the menu item id is recognized
 *
 *  notes:
 *      The following code needs to change if there are more than 10 mru files
 *      more than 100 default options, more than 100 tools or more than 100 transforms
 ******************************************************************************/
BOOL MenuOnCommand(WPARAM wCmd)
{
    HWND hwnd = ChildGetActive();
    CHILDINSTANCEDATA PICFAR* pInstance = ChildGetInstanceData(hwnd);

    if ( pInstance == 0 || pInstance->nWaitCursor != 0 )
        hwnd = NULL;
    
    switch ( wCmd )
        {
        case IDM_FILE_OPEN:
            OpenOnFileOpen();
            break;
        case IDM_FILE_CLOSE:
            OnFileClose(hwnd);
            break;
        case IDM_FILE_SAVE:
            SaveOnFileSave(hwnd);
            break;
        case IDM_FILE_SAVEAS:
            SaveOnFileSaveAs(hwnd);
            break;
        case IDM_FILE_PROPERTIES:
            OnFileProperties(hwnd);
            break;
        case IDM_FILE_IMAGEOPTIONS:
            OnFileImageOptions(hwnd);
            break;
        case IDM_FILE_EXIT:
            SendMessage(hwndFrame, WM_CLOSE, 0, 0);
            break;
        case IDM_FILE_MRUFILE1:
        case IDM_FILE_MRUFILE2:
        case IDM_FILE_MRUFILE3:
        case IDM_FILE_MRUFILE4:
        case IDM_FILE_MRUFILE5:
        case IDM_FILE_MRUFILE6:
        case IDM_FILE_MRUFILE7:
        case IDM_FILE_MRUFILE8:
        case IDM_FILE_MRUFILE9:
            OpenOnFileMruOpen(wCmd - IDM_FILE_MRUFILE1 + 1);
            break;
        
        case IDM_WINDOW_NEWWINDOW:
            OnNewWindow(hwnd);
            break;
        case IDM_WINDOW_CASCADE:
            SendMessage(hwndMDIClient, WM_MDICASCADE, 0, 0);
            break;
        case IDM_WINDOW_TILEHORIZONTAL:
            SendMessage(hwndMDIClient, WM_MDITILE, MDITILE_HORIZONTAL, 0);
            break;
        case IDM_WINDOW_TILEVERTICAL:
            SendMessage(hwndMDIClient, WM_MDITILE, MDITILE_VERTICAL, 0);
            break;
        case IDM_WINDOW_ARRANGEICONS:
            SendMessage(hwndMDIClient, WM_MDIICONARRANGE, 0, 0);
            break;
        case IDM_WINDOW_CLOSEALL:
            OnWindowCloseAll();
            break;

        case IDM_HELP_CONTENTS:
            WinHelp(hwndFrame, APPLICATION_HELPFILENAME, HELP_CONTENTS, 0);
            break;

        case IDM_HELP_ABOUT:
            AboutOnHelpAbout();
            break;

        default:
            if ( wCmd >= IDM_FILE_DEFAULTOPTIONS && wCmd < IDM_FILE_DEFAULTOPTIONS + 100 )
                OnFileDefaultOptions(wCmd);
            else if ( wCmd >= IDM_TRANSFORM && wCmd < IDM_TRANSFORM + 100 )
                OnTransform(hwnd, wCmd);
            else if ( wCmd >= IDM_TOOLS && wCmd < IDM_TOOLS + 100 )
                OnTools(wCmd);
            else
                return ( FALSE );
        }
    return ( TRUE );
}